The grammaticality of your sentence is a good example of the mess people get into when they starting thinking about grammatical case in English, and why "whom" gives so much trouble.
There is such a rule, but it is not about whether the relative pronoun would be "who" or "whom": it is about whether or not the NP (noun phrase) which is the antecedent of the relative clause is the subject of that clause.
The man who came yesterday was French
you cannot omit "who", because "the man" is the subject of the relative clause.
The man (who(m)) I saw yesterday was French
you can, because "the man is the object of "I saw".
In simple cases there is only one clause introduced by the relative, so if the antecedent is not the subject of it, it will be in the objective case, and "whom" is appropriate, if we use it at all.
The man (whom) I saw yesterday was French
But the given example is complex, with an embedded clause [I hope [(that) he will come], so the antecedent "the man" is actually the subject of the (inner) embedded clause. Thus the structure is
I have (a friend (who I hope (he will come)))
where the 'he' is replaced by the 'who' (not 'whom') in the clause above, and then optionally omitted because neither it nor its containing clause is the subject of the relative clause.
It's worth noting that this is a case where people who do want to use "whom" sometimes get confused, and use "whom" 'incorrectly'.