Oh, wow, that gets totally tangled. If you take Person A’s brain and transplant it into Person B’s body (which, let us hope, would never be available unless Person B had been brain-dead), would the resulting person self-identify with Person A, Person B, or Person C? I would expect they would either feel like a Person C or else feel like Person A but seem like Person B to everyone else.
What kind of legal rights would the resulting person have? What about their spouses and children? Since Person A never became brain-dead, would s/he still own all their previous property? What about Person B’s property? Would they lose their property rights because their brain had died? What about if Person A and Person B both had living spouses? Would the spouse of Person B lose the right to consort? What would the status of either of the marriages be? It’s such an incredible can of worms, even from the prospective of civil law, I can’t even start to imagine it. In the absence of Constitution-level clarification by the legislative bodies, I think it would require the courts to decide if your rights resided in your living brain or in your living body or both or neither. That is a total guess, though.
In the case of Person B being killed before they were brain dead, wouldn’t the estate of B have right to sue the estate of A for damages? You could actually have two parties inhabiting one body, suing each other at the behest of one or both families.
I hope I never live to see this become a serious question.