Smith spoke of the necessity of friendship in the heavenly kingdoms in 1843, but by 1840 he had already taught the doctrine of baptism for the dead, which he explains this way in 1842:
[Referring to Malachi 4:5-6], the earth will be smitten with a curse unless there is a welding link of some kind or other between the fathers and the children, upon some subject or other—and behold what is that subject? It is the baptism for the dead. For we without them cannot be made perfect; neither can they without us be made perfect. Neither can they nor we be made perfect without those who have died in the gospel also; for it is necessary in the ushering in of the dispensation of the fulness of times, which dispensation is now beginning to usher in, that a whole and complete and perfect union, and welding together of dispensations, and keys, and powers, and glories should take place, and be revealed from the days of Adam even to the present time. (D&C 128:18)
Heaven is not heaven unless those who reside there are linked, welded together, as fathers and mothers and children and friends. And that linking is to extend through all human time and, at least in principle, to include all of humanity. As Terryl Givens points out, for Smith salvation means not only reconciliation with God, but reconciliation with all those whom we love, ultimately with the whole human family.
That is the point of the Mormon doctrine of sealing: those who accept baptism (and not all for whom we are baptized by proxy will accept it; they continue to have their agency—and none of those who are baptized by proxy are counted on the church rolls as Mormon converts) can be sealed (linked, welded) to their loved ones. LDS temples exist so that we can do rites for the living, but even more rites are done in them by proxy for those who have died.
Some Mormons seem not to understand their own beliefs. The point of doing the research needed to submit names for proxy ordinances is ultimately to create that welding link between the members of one's family. I am to submit the names of my deceased ancestors so that they, if they so wish, can be part of the linkage created by those ordinances. We can be sealed as a family. From a Mormon point of view, therefore, the baptisms or other ritual work for celebrities or famous people or Holocaust victims to whom one has no kinship relation make no sense.
The important point about sealings and baptisms for the dead is not so much about making converts of the dead. We perform those rituals primarily to create familial links between our loved ones who have died, ourselves, and our children.
Why do we seal spouses to each other, children to parents, and living persons to their ancestors? Why do we baptize our ancestors who have passed on by proxy? Because we want our ancestors and others—all humankind—to join with us in the eternities as friends and loved ones before the throne of God.
Note: In April of 2012 I published a column on the LDS relationship with the dead, "They without Us Cannot Be Made Perfect." This is a revised version of that column.