He is showing dominance over you, that's my point.
He's in charge of who you pet.
He's in charge of letting the other dog near you.
If YOU were in charge, and he knew it, this wouldn't be a behavior you would see.
Have fun in dog classes, you'll be amazed how much more respect and love you get once your dog gets the balance in the home.