I can recall cases similar to this in the US, although I don't know if it has gone to the extreme of heart transplants, which
IMO constitutes extraordinary means to keep a person alive. Of course, we have had cases, most notably that of Terry Schiavo (
link), where the loved ones want to remove the person from life support (which is also extraordinary means) and run into opposition from the hospital or other people claiming an interest. In the case of Schiavo, that included the United States Congress

.
A heart transplant is an incredibly invasive procedure, and would have lifelong consequences to the girl if she lived, such as having to take immunosuppressant drugs for the rest of her life, live with the possibility of transplant rejection, etc.
There is an irony here, too. While on the one hand hospitals do things like this to try to force medical intervention when it is not wanted, on the other hand people (including children) are dying in the US because they do not have health insurance and therefore cannot afford to get the treatment that would keep them alive.