watch and listen to “The Dog Whisperer”- be calm and assertive! Many things doggies do is wolf pack behavior.
Dog is challenging you as male intruding into his pack. He doesnt want you in his/his master’s pack. He knows he is pushing your buttons.
Your friend needs to step up, take charge and teach doggie who is alpha male (or female?) in that house. Your friend gets to decide who comes into the house (the den)...not doggie
Friend needs to put doggie into submissive role (down-stay or on his back) when you come over, until doggie accepts master’s decision and stops challenging you.
This alpha male-wannabe bigdoggie may never be your friend but he needs to learn to accept you because his master is the alpha pack leader and his master commands it.
Yeah, doing all that. Calm and assertive. Not backing down, but not trying to aggravate him either. And my friend is working on training, so the problem probably won’t last. I’d just prefer to speed it up. Aside from the behavioral issue, it really is a cool dog.