It's always said that a lot of success and opportunities are attributed to being in the right place at the right time (aka "luck"), but in a lot of cases, those folks had the tenacity to be in the right place ALL the time; when opportunities arise, they typically go to whoever's present and available.
Chatting with professors after class or attending office hours might be a grift, but it's not necessarily unfair. Specific circumstances aside, anybody can do it to get some leverage.
What's the old saying? So much of success is up to luck, but you can make your own luck?