Question: what to say to a friend when they lose a child?
Answer: Offer sincere condolence. "I am so sorry for your loss" is a good example.
Offer open-ended support. "If there is anything I can do, please let me know. ... 
Offer silence. ... 
When the time is right, express what the deceased child meant to you.