The only philosohpicalphilosophical elements that Rand shares with Heinlein is the idea of self reliance and rational self interest. They both believed that that only duties chosen voluntarily were really worthwhile, and that only free individuals could really choose those most worthwhile values.
Beyond that, Rand was an athiestatheist who viewed altruism as immoral, while Heinleien'sHeinlein's "StrangerStranger in a Strange"Strange Land Land is a wholesale indictment of Rand's assertion that altruism is a fake value. He also firmly endorses religion in this book, even to the point of making his protagonist into the Archangel MichealMichael. Heinlein also clearly thought very little of those who rejected such values as duty, honor, patriotism, and self-sacrifice, as seen in "Starship Troopers". This makes it likely that Rand would have considered Heinlein “ultimately an altruist” and thus abhorrent to her view that the individual mattered more than the group in all circumstances and that any system of values which rejected that was oppressive.
The character in "TheThe Moon is a Harsh Mistress"Mistress, compared to John Galt, has been noted to have been a computer in an attempt to satirize Rand's work. Further, in "Beyond This Horizon"Beyond This Horizon, all basic human needs are free, and one character is quoted as saying, in a shocked tone of voice: “Naturally food is free! What kind of people do you take us for?”