I had a position that might be described in this way. I was the in-house consultant for all mechanical systems questions for a medium sized aerospace manufacturer. I must say, it was great fun, and never, ever, was it dull. I was available to all the engineering staff on a walk-in basis, and some or their problems I could solve in 15 minutes, while others would take 15 days.
I got that position because of a former student who was already employed with the company. When the company saw the need and began looking for someone, he put my name forward and that's how it came about. In a more general sense then, I think we could say that such things happen by knowing the right people and by being known to them.
I should add that, at that time, I had almost 40 years of work experience, so this is not something likely to happen straight out of school.