סימן נט סעיף ה
יָלְדָה אִשְׁתּוֹ זָכָר, מְבָרֵךְ הַטּוֹב וְהַמֵּטִיב, וְגַם הָאִשָּׁה תְּבָרֵךְ כֵּן. וְאִם מֵתָה הָאִשָּׁה בְּלִדְתָּה, מְבָרֵךְ שֶׁהֱחֱיָנוּ, דְּהָא לֵיכָּא הֲטָבָה לְאַחֲרִינֵי. וְכֵן אִם מֵת הָאָב קֹדֶם שֶׁיְלָדַתּוּ, הִיא מְבָרֶכֶת שֶׁהֱחֱיָנוּ.
When the wife gives birth to a son,6The first time you see your baby daughter, you should say Shecheyanu. (Mishnah Berurah 223: 2) the father says the berachah Hatov vehameitiv. The mother, too, should say this berachah. If the mother dies in childbirth, the father says Shehecheyanu,7Shehecheyanu is preceded by Dayan Ha’emes over the mother’s death. (Mishnah Berurah 223: 6) because the good has come only to him. Likewise, if the father dies before she gives birth, she recites Shehecheyanu (when the child is born).
תנא דבי אליהו כל השונה הלכות בכל יום מובטח לו שהוא בן העולם הבא שנאמר הליכות עולם לו אל תקרי הליכות אלא הלכות (נדה ע"ג.)