To make it clearer, consider:
* Who is doing the hearing? For example:
* "The news was heard by a friend." (This is passive voice, so it's not clear who actually heard the news.)
* "My friend heard the news." (This is active voice and shows who did the hearing.)
* What is being heard? For example:
* "The story was heard by a friend."
* "A friend heard my story."
It also depends on the context of your sentence. If you are trying to say that someone told a friend something, it would be more natural to say "My friend was told...".
In short, "heard by a friend" is correct grammatically, but it can be improved by adding more context and using active voice when possible.