"Bill, thank you. The world's a better place," Jobs told Gates after the Microsoft exec agreed to make a $150 million investment in Apple .

Steve Jobs and Bill Gates ' rivalrous friendship is the stuff of tech lore. The most poignant moment of that fraught relationship happened 20 years ago. In August of 1997, Gates stepped in and saved Apple , which, at the time, was on the brink of bankruptcy.

Ten years later, when the iconic tech leaders met on-stage at the D5 tech conference, interviewed by Kara Swisher and Walt Mossberg, they reflected on their coming together.

The corporate olive branch shocked the tech and business communities. "Even in cyberspace, the moment can only be described as surreal ," the New York Times opinion section wrote in the wake of the deal.

At the time, that quote was memorialized on the cover of Time Magazine and was recently resurfaced by Code Academy on the online coding school's Twitter feed.

"Apple was in very serious trouble," said Jobs. "And what was really clear was that if the game was a zero-sum game where for Apple to win, Microsoft had to lose, then Apple was going to lose.

"There were too many people at Apple and in the Apple ecosystem playing [that] game," he explained. "And it was clear that you didn't have to play that game, because Apple wasn't going to beat Microsoft.

"Apple didn't have to beat Microsoft. Apple had to remember who Apple was because they'd forgotten who Apple was."

To stay alive, Jobs had to step outside of the competitive mindset.

"To me, it was pretty essential to break that paradigm," says Jobs. "And it was also important that, you know, Microsoft was the biggest software developer outside of Apple developing for the Mac. So it was just crazy what was happening at that time. And Apple was very weak and so I called Bill up and we tried to patch things up."

The two founders did just that, though their partnership met with resistance. When Jobs announced the $150 million investment at the Macworld Boston conference in 1997, the audience booed Gates' appearance via satellite.

For Microsoft, the investment meant propping up one of its greatest competitors, but it was also a new business opportunity.

"That's worked out very well," says Gates at the 2007 conference. "In fact, every couple years or so, there's been something new that we've been able to do on the Mac and it's been a great business for us."

Also, as part of the deal, Apple agreed to drop a lawsuit accusing Microsoft of copying its operating system.

At the time that Microsoft saved Apple, Microsoft was by far and away the larger of the two companies. That standing has since flipped: Apple's market capitalization is $839 billion and Microsoft's is $560 billion.

The 1997 deal didn't end the competition between the two tech companies. Rather, they went on to, in lockstep, shaping the computing industry together.