But, as your friend thought, being respectful is also important. By all means say thank you, but don't expect much response beyond an acknowledgement. Famous people get TIRED of strangers talking to them, as much as they like the random encounters.
I suspect that varies. Actors, e.g., are far more likely to be recognized. I think the only author I’m a fan of who I’d recognize is Asimov, and obviously I’m unlikely to meet him on the street.