I would part company with you here in that is is good and right that we thank God for the friends we have/had on earth. But prayer can't change the future or lot of one departed. The writer of Hebrews tells us,
27 And just as it is appointed for man to die once, and after that comes judgment, 28 so Christ, having been offered once to bear the sins of many, will appear a second time, not to deal with sin but to save those who are eagerly waiting for him.
prayer for the dead avails nothing, if he be saved, he has no need of prayer; if he be damned prayer has no effect. But it is a good reminder to pray for those we love in this world that God may bring them to the knowledge of the truth and for those that have it, that God strengthen their faith that they may persevere to the end.
I don’t pray for the dead. To God, all time is now. So, the moment before death of any person who lived, is living or will live is now to God; as is every moment of their life. But, hey, that’s just me talking.