Let's say a ghost possesses somebody and then the party wizard casts charm person on the body. Is the ghost affected by the charm, or is the body? And if the body is, does it limit the ghosts ability to attack you using that body?
First the Charm Person has no effect on the ghost possessing the body and the ghost retains complete control.
From the wording of possession on page 147 of the 5e Monster Manual.
The ghost can't be targeted by any attack, spell, or other effect, except ones that turn undead, and it retains its alignment, Intelligence, Wisdom, Charisma, and immunity to being charmed and frightened . It otherwise uses the possessed target's statistics, but doesn't gain access to the target's knowledge, class features, or proficiencies.
Because of this
The ghost now controls the body but doesn't deprive the target of awareness.
I would rule that the possessed character would have to make a save versus charm. And if the spell is still in effect when the possession end that character would be charmed to the caster. But keeping in mind that the Ghost is the one in control of the character's body during its possession.
However this is how I would rule as there is no explicit rule covering the effect of mind control spells on the original character while being possessed.
The Ghost's Possession ability includes the following important clause:
The ghost can't be targeted by any attack, spell, or other effect, except ones that turn undead[...]
So it's impossible to use Charm Person on the ghost. Of course, it would have been impossible anyway, since the ghost is not a humanoid and is immune to being charmed.
As for using Charm Person on the humanoid being possessed, it is clearly still
a humanoid you can see within range.
Charm Person will work on the creature being possessed. This will give it the Charmed condition and make it regard the caster as a friendly acquaintance. Since the creature retains awareness, the effect of regarding the caster as a friendly acquaintance will function as normal. Then, the Charmed condition:
- A charmed creature can’t attack the charmer or target the charmer with harmful abilities or magical effects.
- The charmer has advantage on any ability check to interact socially with the creature.
The creature can't attack the caster or target the caster with any harmful effect, but the creature couldn't have done so anyway, since it can do literally nothing while being possessed. Advantage on ability checks to interact socially with the creature is fairly obviously useless under the circumstances.