For more than three decades, she has given life advice, a shoulder to cry on, and brand new cars to complete strangers, before a devoted audience of millions who revere her as something of an oracle. But when Oprah Winfrey needed advice herself, she turned to her longtime mentor and friend Maya Angelou, who died on Wednesday at age 86.

“She never tells me exactly what I want to hear, but always what I need to hear,” Oprah said during a segment dedicated to Angelou on a 2011 episode of her OWN network’s “Masterclass.”

Winfrey has said she felt immediately connected to the writer when she first read Angelou’s 1969 autobiography “I Know Why the Caged Bird Sings.”

“Meeting Maya on those pages was like meeting myself in full,” she wrote in her O Magazine. “For the first time, as a young black girl, my experience was validated.”

And since their first actual meeting when Winfrey was in her 20s, the extraordinarily successful talk show host has seen Angelou as a mother and a sister figure, as well as a dear friend. She has repeatedly said that Angelou was one of the greatest influences in her life.

Angelou and Winfrey first crossed paths nearly 40 years ago, when the young local news anchor begged Angelou for an interview, promising that she would not take more than five minutes of her time. Though the author initially declined, she eventually acquiesced, impressed by the young journalist’s persistence. And she was further impressed when Oprah ended the interview after exactly five minutes.

They became closer when Winfrey was in her 30s. In an episode of OWN’s “Life Lessons,” she recalled the first time she visited her idol at home. “She was the biggest rock star in the world to me, and now I’m sitting in her house,” she remembered thinking.

During that same visit, Winfrey talked to her friend about some of the mistakes and regrets of her younger years. Angelou gave her some words of wisdom that she would always take with her, and repeatedly share with guests on her show: “When you know better, you do better.”

It’s a small wonder that Winfrey and Angelou shared such a strong bond. In many ways, their personal histories – marked by trauma and perseverence – are similar. Both were raped by people close to them at a young age: Angelou by her mother’s boyfriend when she was seven years old, and Oprah, as she first revealed on her talk show in 1986, by a relative when she was nine.

The similarities don’t end there: Both women came from broken families and were raised primarily by their grandmothers in the South. Both gave birth in their teens, though Oprah’s baby, born prematurely, died not long after delivery. Angelou raised her son, Guy Johnson, as a single mother, with the help of her own mother.

And both Winfrey and Angelou became known as modern renaissance women for their mastery of multiple pursuits -- though Angelou’s career has been so varied that it’s nearly impossible to contain her life’s work in just a few words.  

“The world knows her as a poet, but at the heart of her, she was a teacher,” Winfrey said in a statement memorializing her longtime friend. “She won three Grammys, spoke six languages and was the second poet in history to recite a poem at a presidential inauguration. But what stands out to me most about Maya Angelou is not what she has done or written or spoken, it’s how she lived her life. She moved through the world with an unshakeable calm, confidence and a fierce grace,” the statement continues. “She will always be the rainbow in my clouds.”

Fittingly, that last sentence is a nod to something Angelou spoke of in the 2011 “Masterclass” interview, when she recalled being invited to the United Nations to recite a commissioned poem. It was the same building she had looked at longingly 50 years before, knowing that she possessed the skills to do a translation job that was on offer at the time for $150 a week.

“And if I wasn’t 6 foot tall, black, pregnant, unmarried, I could go in that building,” Angelou said. “And I cried.”

But the memory of feeling shut out decades before made the invitation all the more meaningful. “Can you imagine what it felt like 50 years later to be asked not only to write a poem but to come back to … that building  and deliver the poem to the heads of state of the world?” Angelou said. It made her think of a 19th century African-American song that included the lyrics 'When it looked like the sun wasn’t going to shine anymore/God put a rainbow in my clouds.'

“I’ve had a lot of clouds," Angelou said. "But I have had so many rainbows.”

Watch a segement from Oprah and Maya Angelou's final interview together: