Here's why:
* Direct Object: The direct object is the thing that is being acted upon by the verb. In this case, the priests taught *reading and writing*.
* Indirect Object: The indirect object is the recipient of the direct object. The priests taught *reading and writing* to the *rich children*.
So, the rich children are the ones receiving the benefit of the teaching.