Don't think on this one too much. It's not bad that you gave a goodbye hug. In fact, it doesn't matter if you hugged her friend or not either.
By hugging you're just showing that you don't take yourself so serious and you're fun. Next time you hug her have fun with it, for instance, sometimes I'll go in for the hug but I won't hug her, I'll just stick my arms out to my side and laugh while she just hugs my body and waits. Then she gets the point and laughs with me, ridiculing me. Then point at her friend and say, "Awwww you must want a hug too huh? Come here!"
Point is, have fun with everything you do, and don't take this so serious. If you normally hug girls then hug! If you normally shake hands then do do so.