When in doubt, ask.
Usually, one can tell who wants to be hugged and who doesn't. One of my close friends allows me to, once in a while. I ask him. Another...well, he thinks it's too gay, so we don't. Unless he asks, which is rare.
As for dates, it's my opinion that a parting hug is always allowed, even on the first meeting. Sometimes a hug is expected as a greeting. It depends on the person and the place, really. Culture, too.