It boils down to temptations, thoughts, sexual desire, etc. If you are simply hugging them without anything sinful on your mind, there's nothing wrong.
If you have any sort of sexual thoughts or temptations about the same gender, yes, avoid hugging. Otherwise, so long as no sinful things are in...