Thanks for the additional information. It is helpful.
There are some medical conditions that can cause sudden aggression and those may be a factor. Unfortunately, these would not be able to be ruled out without testing.
It sounds like your dog may be having issues with dominance aggression. Many dominant dogs are described as well behaved until you try to get them to do something they do not want to do, and then they reprimand you either with a growl or bite if you don't heed the growl. Things like taking away something they want, making them move when they don't want to, waking them up, etc can cause them to reprimand (bite) you. In this case, she may feel that your friend belongs to her and thus guards her. Your friend may be giving your dog more attention and even treats and stuff that you are not doing at this point since you are going to have a little one.
Dogs that are allowed on furniture (even if put on the furniture) tend to feel that since they are elevated to your level or higher if on your lap, they mentally feel elevated as well in the pack order and thus are the boss. Keeping them on the floor can help lower them mentally back to a submissive position in the pack. So the first thing is to not allow her higher that the humans or even on the same level. In addition, humans shouldn't be on the floor with her either. A small short stool is enough to keep them higher than the dog when petting the dog. Attach a leash and use it to remove her from the furniture. Give a correction in the form of a quick tug and firm "NO" when she attempts to get on and a treat when she starts not trying to get on the furniture. Thus you are providing consequences for the getting on the furniture and positive reinforcement for the desired behavior (not attempting to get on the furniture).
There are other ways to regain the dominant position in the house as well. The best way is to start obedience training. While a formal training class is great, you can start obedience training without a formal class. The following site is helpful in helping owners train their dog. Be sure and click on the link to the page on obedience at the bottom. and links on subsequent pages leading to detailed instructions.
Training works best if you train at least 30 minutes a day (two 15 minute sessions). I would start making your dog work via the Nothing in life is free program (NILF). It is outlined below.
You will also want to keep a leash on her at all times initially to grab if she should disobey. I think you will be pleasantly surprised at how well your dog does with training. Dogs like knowing what is expected of them and they love the little paper thin slices of hotdogs that I use for treats while training. Give this a try and see how it works for you.
Additionally, I would suggest you get a basket muzzle and make her wear it when the baby comes initially. Be sure to use the leash to make her obey you. If she growls give a short tug to get her attention and a firm "NO" to let her know, you are not going to allow her aggression. If she is sleeping, give a little tug to let her know that someone is there so she isn't startled when being woken up.
I also recommend some baby training to make the situation safer for your baby when he/she comes. Dogs initially usually treat babies like newborn pups and are pretty lenient with them allowing a lot of behavior they wouldn't from others but they expect a baby to learn what behavior is acceptable and what isn't such as not just pulling on their ears, hugging, etc and will lash out at them sometimes causing real damage. However, you can train your dog to keep their distance from your baby until both your baby and your dog know what interactions are acceptable.
I would start teaching your dog to stay a certain distance away from the baby as soon as the baby comes. You will leash your dog and if the dog gets within 3 feet of the baby, you will give the dog a short tug on the leash and a firm, low toned NO. Since the baby isn't here yet, you might start with a lifesize baby doll and be sure it smells like baby powder. Once she starts stopping the required distance from the baby, start rewarding her with a tasty treat like a thin hot dog slice. At this point you will see her stopping long before she gets to the baby. It is important that you reward this behavior with both treats and praise. Once she has it down pat, you can start sometimes just using praise and sometimes treats so she doesn't know if she is getting treats or not.
At this point, you will want to teach her to move if the baby gets within 3 feet of her. So you will move the baby into her space about 2 feet from the dog and then using the leash move her away from the baby the required distance and give a treat. Since she already know she isn't supposed to be close to the baby, it may only take a couple of times before she sees that she needs to get up and move if the baby enters her space. Since treats are involved, they usually learn quickly. Again, treat for desired behavior. This is important because when the baby starts walking everywhere, the dog needs to move out of the babies way.
Most of the dogs that I have trained have learned within a few weeks but the owners worked with the dogs daily and were very consistent. Once your baby is around 3 years of age, then the baby should be able to say sit and down with a little conviction. At this point, you will start the baby giving the dog known commands to teach the dog that ahe has to obey the child as well.
You can see why obedience training is so important especially with a new baby on the way.
In addition, if the situation is not improving using the techniques on the previous website, you may have to consult a professional behaviorist. You can usually find a behaviorist by asking your Vet for a recommendation or you may be able to find one using the following site.
I hope I've given you great service. If so, I'd appreciate a 5 star rating. The rating should be based on my answer and not any site issue. Experts are not compensated until a rating is done. If you have any other questions at all, please reply here and I'll be happy to follow up with you even after you have rated. .