You takeoff as a passenger just relaxing.
Whiel airborne you together with PIC decide that you could train in this aircraft because the PIC is an instructor.
If, during a flight of this arrangement, the PIC unexpectedly "trains" another person aboard, neither of them should log the flight, as it was just too poorly planned, and it's embarrassing!
Formal preplanned training can be conducted with suitably paired instructor and candidate, and those flights can be logged according to the rules. A pilot can fly as a passenger. If circumstances result in that non PIC pilot flying the plane for a while, they are not entitled to log it at all - it was not training in that context. It could still be good experience though, so value it for that alone!