I'm going to guess that part of the reason why your cat was so bad when your friend visited is because it had no place that it felt truly safe from your visitor. I'm guessing, based on the fact that your cat was hiding under the couch, that your cat had no hiding options that didn't force it to possibly cross paths with your friend if it were to come out, since couches are usually located in the living room, and the living room is usually a central place.
Think if a monster (not that your friend is bad, but that to a cat, strangers are very scary) were tromping around your house. Would you feel safer in the central room where it kept going in and out, or in a room off to the side where the monster never came close to?
Therefore, I think you should not have your friend stay in your bedroom. The bedroom is a common place for cats to hide, they often spend a lot of time sleeping there so it would feel more comforting to them than in a random room they don't normally go, bedrooms are normally not centrally located, and it has a lot of hiding places. Your cat is probably much more comfortable there.
If not the bedroom, pick another room away from where your friend is likely to go, and try to make it up into a pleasant den like area that the cat will like. Give it hiding places and comfortable things to lie on. I recommend doing this before your friend arrives and see if you can convince your cat to use the room.
Also, in preparation for your friend staying, it might make sense to move the box and food and water (or place additional ones temporarily) in that room, so the cat will know to expect them there, and it doesn't have to go far too use these things. But any rate, while your cat is hiding, make sure the food, water, and box are as close to its hiding spot as possible. Just be careful if you do move your cat's necessities beforehand, to make sure the cat has figured out to use them. Some cats don't like their things being moved, so you might have to do it gradually.
Lastly, it might even make sense to shut the cat into the room while your friend is there, so that there's a barrier between it and your friend. If the cat is hiding all the time, shutting it into a single room isn't so bad, because it wasn't going to move around anyways.
If this is potentially a long stay, then I recommend trying to acclimate your cat to your friend's presence very, very slowly. If you are closing the door, after some days, if the cat seems more calm, try cracking the door, for instance. Give the cat the opportunity to come out and investigate, but do not cut off its access to its safe spot. Your friend should only come close to the cat if the cat chooses to approach them. Otherwise, they should give the cat space.
If the stay is expected to be shorter term, there are other possible options, such as boarding the cat. But boarding the cat can also be very stressful, so I don't really recommend it unless it's the better of bad options, such as giving up your cat.