What he said ^^^^
It is also the same situation where you have two sets of crew members on board a commercial airliner. During the flight they switch crew members and the first ones go to bed or sit down to sleep. How do they log this? They are only flying 50% of the flight and 50% of the flight you are for example sleeping.
It depends which aviation authority your are operating under. In the UK (EASA) the nominated commander logs all the flight time as P1 and relief pilots log time in the seat. As far as FTLs go, the whole flight time counts for everybody.
For your logbook, if a rated instructor is happy that he was instructing you, then enter it. You can put anything you like in there as long as both of you are not trying to claim the same thing at the same time.