And that reminds me of some guy I don't know who seems to work or live close to my office and can often be found on the streets. Whenever he's 100m away or I catch him out of the corner of an eye, I think "oh, my friend X is here" and turn around, only to notice "no, just this weird guy from around here". But even though I know it's not my friend the moment I turn my head a different way again, my brains begins to insist anew that he is right over there.
Well, don't forget that the brain plays tricks on us & takes shortcuts.
e.g. You walk into your kitchen every morning. When you walk in, you think you see everything.
You don't.
The mind takes a template of what it normally looks like, then just uses the eyes to scan for differences.
It uses less energy, so is more efficient.
It's why your eye immediately gets drawn to things that are out of place, because they do not match the mental template of "normal kitchen".
I wonder if something similar might be at play, with seeing similarities in people, like that.

The snapshot of the guy has enough similarity for the mind to pair it with the mental image of your friend, so your mind says "It's my friend".
Then, under any form of closer inspection, he looks nothing like him.
But the mind does the same thing again, when you turn away.
A lot of magician's tricks are based on exploiting the way that the eye communicates with the brain, or the shortcuts which the brain takes, in order to make us see something, or not.