A friend recently told me how, just before she would have gotten into an auto accident, she heard the voice of her mother, who had died some years before, telling her, "(Name), stop!!" I told her that this could have been a guardian angel sent by God to keep her safe, using the remembered voice of her mother. When an angel told Joseph that Mary would be the mother of our Lord, we can only speculate what form or voice the angel used. If a person near death reports having actual communication with a departed loved one, could we suggest another possibility, that this could have been a vision of an angel - if whatever "message" was given didn't in any way contradict any truth of God?
Having no firsthand knowledge of the close call your friend experienced, I cannot offer any comments of substance. You are correct in noting that we can merely speculate on the way the angel spoke to Joseph in a dream (Matthew 1:18-25).
When it comes to your question of near-death communications, Christians readily acknowledge that God can do anything. So, if God used angels to communicate with people in biblical days, he certainly can do something similar today. The difficulty for you and me can be knowing the difference between what God can do and what actually took place in someone’s life. In so many circumstances and situations in life, we simply acknowledge, in faith and humility, the immense wisdom and knowledge of God (Romans 11:33-36). In addition, we praise God for communicating with us clearly in his word, the Bible (2 Timothy 3:15-16).