Pretend it's your friend's kid.
As parents, we're very comfortable around our own kids and often let down that extra barrier. If that's the case, pretend that the temper tantrum is coming from your friend's kid. You'll probably find yourself calmer, have a smaller chance of resorting to yelling, and be able to speak to him more objectively.