Your enemy's enemy is your friend
In many species, when plants are attacked by herbivores, they release special chemicals known as Herbivore-induced plant volatiles (HIPVs) which can be used to attract natural predators or parasitoids of would-be herbivores. Therefore, plants can recruit their enemy's (herbivores) enemy (parasitoids) as a way of protecting themselves