Hi Christian,
Thanks for your question! Indeed, this is quite a complex topic so don't worry at all - with a few additional examples it might be slightly easier to fully understand.
As Iain-McC also stated on this thread (yes!), the indirect object comes first and is then followed by the direct object.
- Giorgio chiede a Carola i libri
- Giorgio glieli chiede
- GLIE (to her) + LI (them, the books, masc. pl.)
If I wrote “Giorgio gliela chiede” it would have implied that the “requested” item was a feminine one. You could have used it in this example for instance:
Giorgio chiede a Carola la penna
Giorgio gliela chiede
GLIE (to her) + LA (it, the pen, fem. sing.)
Another example to better understand this rule:
Io preparo la cena alla mamma (I make dinner for my mother)
Io gliela preparo
GLIE (to/for her) + LA (it, the dinner, fem. sing.)
Let's try with another example:
Hai detto a Marco il nostro segreto (You told Marco our secret)
Glielo hai detto
GLIE (to him) + LO (it, the secret, masc. sing.)
Hope this helps, please feel free to share any additional questions if/as needed :)