Abstract wherein R denotes optionally non-chromophorically substituted phenyl, naphthyl or diphenylyl, X denotes hydrogen, halogen, alkyl or optionally non-chromophorically substituted phenyl, naphthyl or diphenylyl, Y1 and Y2 independently of one another denote hydrogen, halogen, alkyl with one to four carbon atoms or alkoxy with one to four carbon atoms, B denotes a benzene or naphthalene radical which is condensed with the azole ring and is optionally non-chromophorically substituted, A denotes oxygen or an imino group, R1 denotes optionally substituted alkyl, alkenyl, cycloalkyl, aralkyl or aryl, R2 denotes optionally substituted alkyl, alkenyl, cycloalkyl or aralkyl and An denotes an anion. These compounds are particularly useful as optical brighteners. New azole compounds of the formula and quaternisation products of the imidazole compounds of the formula