Olaf was based on a snowman Anna and Elsa created when they were young and Elsa appears to have created him as a reminder of her happy childhood memories. When Anna first meets Olaf, she is initially creeped out by the talking snowman but then quickly realizes he is the same Olaf from her childhood when he introduces his name and becomes good friends with him. This is shown as she supports Olaf's dreams of summer and insists Kristoff not ruin it for him and when she was angered when Marshmallow threw him and was willing to confront Marshmallow over the matter.
Olaf returned her friendship as he tried to stall Marshmallow so Anna and Kristoff could escape and again demonstrated when he told Anna to run from Kristoff when he brought them to his family of "rocks" (who were actually the trolls disguised as rocks) and he thought Kristoff was crazy, telling Anna "Because I love you, Anna, I insist you run!" He was even willing to melt to death in order to create a fire to warm up Anna to slow the freezing curse placed on her by Elsa, while comforting her over Hans' betrayal even stroking her shoulders. He also was the one to teach Anna what love was after she felt disillusioned due to Hans' treachery and was the one to inform everyone how it was Anna's act of true love that saved her from dying.
Elsa created Olaf when she and Anna were children, and when she had later exiled herself from Arendelle. Despite the fact their relations aren't explored thoroughly, Olaf seems to care for her deeply and holds admiration towards due to her ability.
When Elsa first saw Olaf alive, she was surprised, but smiled when she saw how much he represented the fun that she and Anna once had. When Olaf started to melt, due to the return of summer, Elsa saved his life by rebuilding him and giving him his own flurry to keep him cool. In the end, he enjoys summer and helps Anna to skate with Elsa, showing that he loves both the sisters.
Olaf immediately grew to like Sven, calling him cute and constantly snuggling his mug. Sven kept trying to take a bite out of Olaf's nose, though Olaf thought he was merely playing and continued to act friendly towards him. At the end of the film, Sven succeeded, but immediately returned it, revealing he was merely teasing, and accepted Olaf's friendship. Their friendship is easily explained by their common traits, being their whimsically childish natures. In spin-off material of the film, Olaf and Sven are featured as a duo, appearing, more often than not, side by side as best friends, sometimes finding themselves in comical mishaps.
Kristoff and Olaf have somewhat of a good friendship and are friendly towards each other. Olaf calls Kristoff as "Sven" before he knew about his new name, and describes him as "funky looking donkey". At first, Kristoff calls him creepy and is confused by the fact that Olaf (being a living, breathing frozen substance) would dream about Summer and being in heat itself. He wants to break the ice and tell the happy snowman that his dream might not be all what he thinks it's cracked up to be, but Anna stops him by smacking him in the arm and scolding him. Kristoff still believes somebody has to to tell Olaf the truth about his dream eventually, but doesn't try to proceed to do it himself.
The moment the snowman met the newly-created Marshmallow, Olaf was excited to meet another like him. However, Marshmallow did not feel the same way, and showed no hesitation in mistreating Olaf. While escaping him, Olaf is the one who gives Marshmallow his name as an off-hand comment, and tries to befriend Marshmallow when the two come face to face, but the snow monster kicks him away out of annoyance.
However, in the tie-in books that take place after the film, Marshmallow appears to have become more childlike, and has grown a newfound friendship with Olaf.