Thank you for your question. Although it is not possible to know the mind of God and all of His purposes, what we are sure of is that a Merciful, Wise and Just Lord would only allow an innocent to suffer if there was a benefit that accrued to that innocent which was worth their suffering in this world. In the case of a child that would be something like a swift entrance into heaven or a higher station within it. As the test pertains to the parents and relatives as well, if they are patient through it they will also be rewarded accordingly.
May you always be successful.