True, the Bible uses the metaphor of having the names of all the righteous written in a book (actually, the Greek word means "scroll") which is kept in heaven. In Scripture it is referred to as "the book of life," and your friend is correct. Everyone whose name appears in this book on the last day will be saved: "[I]f any one’s name was not found written in the book of life, he was thrown into the lake of fire. . . . [N]othing unclean shall enter [the New Jerusalem], nor any one who practices abomination or falsehood, but only those who are written in the Lamb’s book of life" (Rv 20:15, 21:27).
People’s names are written in this book during the present life. Paul speaks of certain women who "have labored side by side with me in the gospel together with Clement and the rest of my fellow workers, whose names are in the book of life" (Phil 4:3).
The question is: Does the fact that one’s name was written in the book of life when one came to God and received initial salvation mean that one’s name will stay in the book of life until the last day, when one would receive final salvation?
The answer is: No. Scripture indicates in dozens of places that one can lose salvation, and it does so in specific connection with the book of life metaphor.
In Revelation 3:5, Jesus states: "He who conquers shall be clad thus in white garments, and I will not blot his name out of the book of life; I will confess his name before my Father and before his angels."
The implication is that if you end up giving in to sin, your name will be blotted out of the book of life and you will be denied before God and the angels, something Jesus elsewhere emphasizes (Mt 10:33, Lk 12:9).
As Jesus puts it, "He who endures to the end will be saved" (Mt 10:22, 24:13; Mk 13:13).