1) if you're just friends, then it's completely out of order. You can't just invade someone's space. If they're letting you hug them, it should be a friendly hug, which it isn't if you touch them in a sexual area.
2) even if it's your girlfriend, she's probably not looking for something sexual if you're just giving her a hug. This depends on the girl, some won't mind, but it can feel like you only want her for sex, because you're bringing sexuality into what should be a normal non-sexual thing.