What if you went to your manager, or whoever you feel is the right person, asked if you could speak one on one, and said...
"I really love working at this company. The work is interesting, I love the people, the culture, <one more legitimate pro goes here>. But I also know I could be making X if I went elsewhere. I love the work I'm doing, and I want to keep doing it here, but I also don't want to be leaving money on the table. What can we do?"
This phrasing, pretty much verbatim, has worked really well for me in the past.
Sometimes I feel that it can be a lucrative trap to become invested in a single person, and then accumulate expectations that far outweigh the responsible obligations of any friendship.
As I have gotten older, a pattern that is working much better for me is the campfire model - I just try to keep a metaphorical campfire going, for people traveling through this life to stop and warm themselves upon while I tend it. I cannot know which direction people are traveling from, or to, or how long their journey has been or will be. But all people need to warm their calloused hands and feet, and I can keep this fire with a bed of rosy coals.
Sometimes someone will stop at my fire and warm themselves without my ever having paid attention, but to them it may have meant all the difference in the world. By keeping this obligation in mind, to simply expect people to need a place to sit a spell, I can at least believe I am helping.
The campfire is a nice way for me to remember we're all suffering, that not a one of us is unique to loneliness. Because sometimes that person who sits down at your fire is the person you have been waiting for, and only by making a seat for them were you able to ever meet.
Salaries never stay secrets forever. Hiding them only delays the inevitable.
Last year we were having a discussion at lunch. Coworker was building a new house, and when it came to the numbers it was let loose that it was going to cost about $700K. This didn't seem like much, except to a young guy that joined the previous year and had done nothing but kick ass and take names. The new guy was arguably the most talented guy in the company by a considerable margin, so he thought someone building a $700K home might've been overextending themselves. The person buying the home retorted that it was reasonable and asked the new guy why he wouldn't buy the Porsche Boxster he considered his dream car. The new guy responded that would never be prudent. That didn't seem right, as several of us at the table could've nearly swung a Boxster with just our bonus.
The conversation ended up in numbers. Coworker building the house pulled about $140K base (median for a programmer was probably $125K), and his bonus nearly matched the new guy's salary, which was an insulting $60K -- and got cut out of the bonus and raise in January for not being there a full year, only 11 months.
Turns out he was a doormat in negotiating, though his salary history was cringeworthy. It pained everyone to hear it, considering how nice of a guy he was. In all honestly, $60K was a big step up for him. Worst of all, this wasn't a cheap market (Boston). The guy probably shortchanged himself well over a half-million dollars in the past decade. This was someone who voluntarily put in long hours and went out of his way to teach others, and did everything he could to help other departments like operations and other teams. On top, he was beyond frugal. Supposedly he saved something around 40% of his take home pay, despite living alone in Boston. He grew up in a trailer park.
He spent the next day in non-stop meetings with HR, his manager and the CTO. That Friday he simply handed in his badge without a word, walked out and never came back.
Until 3 months later. As a consultant. At $175/hour.
"I really love working at this company. The work is interesting, I love the people, the culture, <one more legitimate pro goes here>. But I also know I could be making X if I went elsewhere. I love the work I'm doing, and I want to keep doing it here, but I also don't want to be leaving money on the table. What can we do?"
This phrasing, pretty much verbatim, has worked really well for me in the past.