It would have to come down to the unanimous decision of the child's parents or guardians. Such a final and all-encompassing decision is not something I would wager that most kids, if any at all, can truly understand. Let alone decide their own fate with mental competence and have it legally binding. I would wager the same goes for most teenagers, though there would obviously be outliers there like how there would surely be outlier cases with kids. In any case, the child involved would most likely not be someone who has any quality of life, let alone the mental competence necessary to decide their fate. They'd most likely be children incapable of any regular day to day experiences typical with us healthier people, their lives bound to their illness or affliction. For there to be any serious consideration in a legal point of view, the child involved would probably have to be a permanently vegetative state or disabled/afflicted to a point where it would be considered a kindness to euthanise them, even moreso than the considerations we give to adults in the same situation. Given how desperately people want to see children grow up, and how we shudder at the thought of harm coming to a child, let alone them dying, it would most likely have to be a significantly terrible case to get any legal precedence for future, less severe cases.
I can't imagine any scenario where the child is given agency over their own death, honestly. It has to come down to what the adults responsible for the child decide what is ultimately best for it. The torture they must be going through should also be considered. They will most likely love their child like you hope most responsible for a child would, but they may come to a point where their love for their child points them in the direction that euthanising them is the best thing to do. I don't think there should be a legal blockade not allowing that to happen. Unfortunately, you're not likely to find many cases like Lorenzo's Oil. The debilitating illness will most likely not have a miracle cure to stave off death and some extent of their suffering. The parents will most likely not have the connections the Odone family had. They're most likely going to be average, traumatised people who just want their child to stop suffering. They want to stop suffering too.
Ultimately, as with any human being, a child has the right to die. I just hope that it doesn't become legal only for the most extreme cases, that there is more dialogue about what is an acceptable threshold and not have the child's life put in limbo until a decision is reached. I'd hate to think that assisted suicide could only be afforded to those at the absolute highest echelons of suffering. It's an awful discussion but one that needs to be had.