The true reason that we grieve for them is not that they have died, but rather that we miss their presence in our lives, and what they shared with us. If we truly grieved death, we would grieve for all who die, and yet we only grieve for our loved ones.
At these times, the mind tends to focus on our “loss”, but it is truly the experiential “gain” our loved ones brought to us that makes us miss them. However, no one can take that away from us. It is part of us, forever stored in our consciousness, life after life.
We can then turn our attention from our grief to the wellbeing of our departed loved ones, reciting prayers for them, as well as performing virtuous acts and dedicating the merit to them.
We can perform acts of generosity, rescue lives (for example, sponsoring human refugees, or animals at a sanctuary), recite mantras (om amideva hrih), or sponsor Dharma activities (publications, teachings, retreats, etc.).
That they are no longer with us in this realm cannot stop us from being their true friends.