‘A’isha said:
I asked, “Messenger of God, what happens to the offspring of believers?’’ He replied, “They are joined to their parents." I asked, “Although they have done nothing, messenger of God” lie replied, “God knows best what they were doing.” I asked, “What happens to the offspring of polytheists?” He replied, “They are joined to their parents.” I asked, “Although they have done nothing?” He replied, “God knows best what they were doing.”
Abu Dawud transmitted it.