What awful behaviour! I can see why your friend was taken aback and defaulted to being overly nice--it's not something you'd ever expect!
I wouldn't have let them in the door. People who don't know how to be polite often need a helping hand. I'd have said something like "the party's over, sorry you missed it, but here's the birthday girl so you can say 'happy birthday'." A request for cake/ice-cream/balloons/goodies would have been met with a confused, "the party's over, so that's not possible. But thanks for dropping by just to say 'happy birthday' to the birthday girl!" Further requests would have been responded to with "how strange, I thought you came here to see the birthday girl, not to get cake. That's really weird. But since the party's over, that isn't possible anyway. So thanks again for dropping by and see you later!" over and over until they got the point.
It might seem crass, but honestly, what they did was appalling! There's nothing rude in drawing attention to when others are being inappropriate if it helps them see what they're actually doing. Just follow it up with an emphasis on doing the right thing, or on what they should have done and now are about to do at your prompting. Most people are too embarrassed to do otherwise, especially if you do it nicely or in a confused way, rather than confrontationally.
I went to a school where you had to invite the whole class. I could understand the reasons for the policy, but I didn't like it. And just about every single time, the parents of the few kids you wouldn't have wanted to invite would bring along various uninvited siblings or small cousins as though it were an acceptable thing to do. I wish someone had the spine to turn them away rather than let them continue to impose on the birthdays of twenty children throughout the year. Just a "oh, thanks for bringing <invited child>, I'd better let you go now with <uninvited one> since you've obviously got something special planned for the two of you if you had to bring him/her with you just to drop off <invited child>. Hope you two have fun! Bye!"