The pain of losing a pet can hurt just as intensely as the death of a human relative, a study has shown,