Question: what do you say when a friend loses 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.