If he can't treat you well in front of his friends I wouldn't hang out with him any longer.If he was really your friend why would he give other people the intentions that he hates you? That's not the kind of boyfriend,or friend you need.
If you value your friendship I suggest you sit him down and talk about it,you don't need to take that kind of thing from anyone, especially friends.
Well, maybe he's afraid to show his true feelings for you in front of his friends.. I mean, when it's just you and him. is he nice to you? I mean if he is, then he's probably just shy and afraid that his friends will give him a hard time.
But when it's just you and him and if he's rude to you then he probably doesn't like you.
If your situation is anything like the first one...then I'm sure he's just shy.