Even with my friends, I say “I’m going to hug you now, okay?” and wait for response before going in for a hug. If they seem like they aren’t in a place for a hug (being upset in some way), I ask “would you like a hug?” and respect if it’s a no. And those are my friends!