On The Origin of Species by Charles Darwin Chapter 8 Page 27

species than when reared by their own mother, encumbered as she could hardly fail to be by having eggs and young of different ages at the same time, then the old birds or the fostered young would gain an advantage. And analogy would lead us to believe that the young thus reared would be apt to follow by inheritance the occasional and aberrant habit of their mother, and in their turn would be apt to lay their eggs in other birds’ nests, and thus be more successful in rearing their young.

By a continued process of this nature, I believe that the strange instinct of our cuckoo has been generated. It has, also recently been ascertained on sufficient evidence, by Adolf Muller, that the cuckoo occasionally lays her eggs on the bare ground, sits on them and feeds her young. This rare event is probably a case of reversion