Long ago I used to fake sleepwalking into my roommate's bed and hug her while she slept whenever I felt scared or sad or worried.
Did you ever ask your roommate if it was okay if you hugged her while she slept?
No, she would think I was a pervert.
I understand that you were scared, but hugging someone who is asleep without their consent is an invasion of personal space and autonomy. You should ask people if it's okay to hug them first.
What's your problem? I'm a girl and I naturally hug girls.
Even so, people can feel like they're being taken advantage of when people do things to their body without their consent, especially when they're unconscious. It's best to ask before hugging people, even if it feels normal and fine to you.