When I first got Ruby, if you touched her while she was resting you would get an unfriendly grumble. However, if she was on the couch or on my bed, she was promptly moved to the floor. She learned that if she wanted to stay in the comfortable spot, she better be nice or else she'd lose the privilege.
Additionally, I did what Jazzy's Mom did just to prove to her that she wasn't running the show…because I knew that she could be a crank, I would pet her any time she was lying down because I wanted her to not react to being touched while sleeping. Now she is great. Although, once in a while she will let out a big sigh if she is being "bothered" by me.
I will say, that I tell anyone in the house to talk to the dogs before walking up to them if they are sleeping...just so they won't be startled. Once their eyes open, and even if they close them again, they are fine to be touched by anyone in the house.