If there's room, you can make a "closet bed" / "Murphy bed". Essentially just hinge the mattress/bed to the wall and lift the other end when not in use.
Much more robust and less finicky than lifting the whole thing up under the roof.
If there's a folding bed variant that suits your needs (sleeping comfort, size etc) then that may also be a space saving alternative.