My friend died today & I dreamed about this before his death

About 2 weeks ago I had a dream my friend died, sadly he passed away today💔😞 
Now my question is why did I dream about this?? Was god trying to give me a sign to warn him? I'm so heartbroken I've been crying all day i just feel really messed up right now I feel like I could've warned him. & no he didnt die of any sickeness he got stabbed & just died 😢Â