Me and a friend are looking at taking a transcontinental flight together. It appears that for this particular flight, business class is $2000 more than economy. This would be too expensive for us to book, but what if we shared? Would it possible for me to fly in the business class seat for the first half of the flight, then swap with my friend who has booked an economy seat? That way we both get to sleep for half of the flight without spending too much money.
Generally no. Almost all airlines have policies these days that you have to stay in your ticketed cabin. Only one name can be on a ticket and on the boarding pass that assigns a seat to the passenger and the flight attendants use this info to find stragglers, hand out special meals, count passengers, give out status goodies, etc.
As with most things flying, the flight crew has a fair bit of discretion, and you can always ask. They may say yes, they may say no, there is no way to tell up front.
Here is a related cautionary tale: The family of a 94 old woman chipped in for a business class ticket so she could go from Australia to the US to visit relatives (probably for the last time). Her daughter was flying with her so she could attend to her frail mother's needs occasionally (operate seat, open food, etc.). However the daughter could only afford economy and needed permission to occasionally go into business and check on her mother. On the outbound, that all went fine. On the return, the crew categorically denied her access to business and since the old woman couldn't be unattended for 16 hours, they had to move her to economy which was a traumatic experience. https://www.mirror.co.uk/news/world-news/united-airlines-staff-forced-frail-10216619
So the answer is: Maybe, if you are lucky and staff feels like it.
Practically, it should work fine; but you have no guarantee. Changing seats is very common, so once you are on board, nobody cares about seat switches within the class. They do care for switches between classes, but mostly because people might use it to 'sneak' into business class and take an unsold seat.
Formally, the personnel on board has the ultimate decision where you sit, and they typically don't let someone walk from Economy into Business class. However, if the person in business class goes back, and you then go forward, it should work. I recommend that you exchange your boarding passes (very simple if they are electronic), so when you walk forward, if asked, you can pull out his boarding pass to show you have that business class seat. But they might remember your face and his, so you will have to explain what you do, and then it's up to their mood of the day.
We have successfully done that before, but as I said, no guarantees that they will not have their picky day.