Dividing HP between two actors

I want to make a skill that divides hp between two actors.

The way it would work would be like this.

Actor A has 1000 HP. Actor B has 500 HP.

Actor A uses the skill on Actor B.

Both Actors now have 750 HP
You have my permission to do so.

Okay joking aside, you could do this in the damage formula, but are you using auto battle at all? Because if you are that'll mess things up.
I'm not using autobattle. What would the formula be?

Original thread: https://forums.rpgmakerweb.com/threads/dividing-hp-between-two-actors.156013/