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.
However, Olaf was not dislike by the ice harvester. Kristoff also warned Olaf to be careful and not be seen when they rushed back to the kingdom, possibly out of concern for Olaf since people might get frightened by him and attempt to harm him.
Olaf also showed concern for Anna and Kristoff, and told them to run while he tried unsuccessfully to distract and hold off Marshmallow, indicating that Olaf cared for their safety and that Olaf considered Kristoff a good friend as he wanted to save him. He also told Anna that Kristoff loved Anna, and that his act of returning her to Hans to save her was an act of true love, showing that he understood Kristoff well enough to become aware of his feelings for Anna. However, Olaf did think Kristoff was crazy for a moment when Kristoff brought everyone to his family of "rocks", and warned Anna to run before his family of rocks revealed themselves to the group.
Although they don't interact much in the film, it would seem that Olaf sees Kristoff as a good friend and vice versa, which is made stronger by their equal love for Anna.
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.