The reaction of aniline (I) with 4-hydroxybenzoic acid (II) by means of P2O5 in refluxing toluene gives N-(4-hydroxybenzoyl)aniline (III), which is then condensed with pyrrolidine (IV) and formaldehyde (V) in refluxing ethanol.