If a 5 year old yells at you and misbehaves in front of your friends, it is NO WORSE than if he yelled and misbehaved at you in private.
Make sure the punishment or repercussion to the child is for the right reasons. The fact that you felt embarrassed, your image of raising ‘good kids’ and being a ‘good parent’ got a bit tarnished, should have NO bearing on how you choose to deal with that misbehavior.
Further, the message that ‘you need to be good in front of others’ should NOT at all be part of the message.
Well at some point when they are older yes, how they behave in front of others also would become part of their training, but not for a 5 year old.