JI Packer, in Knowing Christianity:
We need not be discouraged by the problem of supposedly unanswered prayer. I say “supposedly” because I challenge the supposition.
While God has not bound himself to hear unbelievers’ prayers, his promises to answer the prayers of his own children are categorical and inclusive. It must then be wrong to think that a flat no is ever the whole of his response to reverent petitions from Christians who seek his glory and others’ welfare.
The truth must be this: God always acts positively when a believer lays a situation of need before him, but he does not always act in the way or at the speed asked for. In meeting the need, he does what he knows to be best when he knows it is best to do it.
The parable of the unjust judge shows that God’s word to his elect concerning the vindication for which they plead is “wait” (Lk 18:1-8), and he may say “wait” to other petitions as well. Christ’s word to Paul, “My grace is sufficient for you, for my power is made perfect in weakness,” when Paul had sought healing for his thorn in the flesh (2 Cor 12:7-9), meant no, but not simply no. Though it was not what Paul had expected, it was a promise of something better than the healing he had sought. We too may ask God to change situations and find that what he does instead is to give us strength to bear them unchanged. But this is not a simple no; it is a very positive answer to our prayer.
I remember a scene from my childhood. As my eleventh birthday approached I let m parents know by broad hints that I wanted a full-size bicycle. They thought it was too soon for that and therefore gave me a typewriter, which was in fact the best present and became the most treasured possession of my boyhood. Was not that good parenthood and a very positive answer to my request for a bicycle? God too allows himself to improve on our requests when what we ask for is not the best.