Why does my guy "friend" treat me like crap whenever his girlfriend is around?

Ugh...I'm really getting a little sick and tired of the fact that my guy "friend" acts so weird around me whenever his girlfriend happens to be in my vicinity.

(Back story):

I used to have a huge crush on this guy friend of mine. Even though we never really dated, over the years I think there was always sort of a mutual attraction between us, but we never actually addressed it.

Well...he's moved on now and started dating a new girl a few months ago this year, and even though I was kind of hurt at first, I've gotten over it. But NOW...I've just started to notice a pattern.

He acts "funny" and sometimes even downright mean towards me whenever his girlfriend is around. But when she's not around, he & I are pretty cool. In fact, he's usually teasing me, and being even a little flirty.

What is UP with him? Why the sudden Jekyll/Hyde behavior? Why can't he just be "normal" with me when his girlfriend is in the room? I feel so hurt... :( I never did anything to him. Why does he treat me this way? I can deal w/someone not being my friend, but he'll act like my friend whenever she's not around, but then act like he barely knows me when she's around.

It's so not fair...

How do you handle a situation like this? I'm starting to dislike him. I need advice! PLEASE!