Airplanes for such long distance flights already have crew rest areas. Here's an article that talks about the ones for the 787:
https://www.executivetraveller.com/here-s-where-qantas-pilot...
https://www.executivetraveller.com/here-s-where-qantas-pilot...
Critical parts of the flight (such as take off and landing) will have the two most senior pilots in command, but less demanding parts in cruise, one of the second officers will be backing up one of the senior crew while the other 2 crew members have mandated rest.
Because these are 'hot bunks', you only need 2 available for the flight crew at any time. I assume the cabin crew have a similar rotation system.