I'll take my chances of having an accident or being in a firefight rather than surrender to a criminal. I don't care if it's $20 or $2000.
Thus is the crux of the problem revealed. Regardless of how either of us random internet persons feel about firearm ownership, you seriously OVERESTIMATE your ability and UNDERESTIMATE the danger of escalating such a situation. Surrendering small private property to a criminal to avoid escalating to physical damage should not cause such a sharp cut to your ego.
Every single piece of defensive training material I have ever seen, studied, or discussed starts with an attempt to deescalate from violence. Awareness, prevention, avoidance, and deescalation of violence are orders of magnitude more effective in preventing bodily harm and serious injury (to all parties involved). Surrendering some private property may be the cost.
One of the things you clearly OVERESTIMATE is the effectiveness of having a firearm. Presumably your friend was surprised by his assailant. If you'd been present with your firearm, you would not be able to draw it and aim without alerting the assailant. While he may choose to flee, he may also choose to escalate to using that knife on you or one of your friends. That's a worse situation, all around.
Even more likely, and more dangerous, the assailant may have seen the firearm before hand. In that case, he may choose to disarm you before you are aware of his presence. In that case, you are now being robbed at gunpoint. At the very least, you've lost a gun worth much more than $20.
Being aware of your surroundings and being prepared to surrender a meager amount of personal property (you keep the real money hidden, right) is generally more effective. There are times when escalating to violence is unavoidable or more acceptable, but they are rare and you need proper training to have a chance of avoiding serious harm. I'm not against people carrying guns, just untrained, macho morons who don't have the good judgement to not use it.