A copolymer obtainable by polymerization of a) at least one α,β-ethylenically unsaturated monomer a) of the general formula I where R 14 and R 15, independently of one another, are selected from the group consisting of hydrogen, C1-C8 linear- or branched-chain alkyl, methoxy, ethoxy, 2-hydroxyethoxy, 2-methoxyethoxy and 2-ethoxyethyl, R 17 is hydrogen or methyl, R 18 is alkylene or hydroxyalkylene having 1 to 24 carbon atoms, optionally substituted by alkyl, preferably C 2 H 4, C 3 H 6, C 4 H 8, CH 2 -CH -CH 2, g is 0 or 1, Z is nitrogen when g = 1 or oxygen when g = 0, R 25 and R 26 are in each case and independently of one another selected from the group consisting of hydrogen, C1-C40 linear- or branched-chain alkyl, formyl, C1-C10 linear- or branched-chain acyl, N,N-dimethylaminoethyl, 2-hydroxyethyl, 2-methoxyethyl, 2-ethoxyethyl, hydroxypropyl, methoxypropyl, ethoxypropyl or benzyl, where at least 60 mol% of a) have at least one quaternary nitrogen atom, b) at least one α,β-ethylenically unsaturated monomer b) of the general formula II where R 1 to R 3, independently of one another, are hydrogen, C 1 -C 4 -alkyl or phenyl; c) at least one α,β-ethylenically unsaturated monomer c) of the general formula III where one of the radicals R 4 to R 6 is a group of the formula CH 2 =CR 7 - where R 7 = H or C 1 -C 4 -alkyl and the other radicals R 4 to R 6, independently of one another, are H, alkyl, cycloalkyl, heterocycloalkyl, aryl or hetaryl, where R 4 and R 5, together with the amide group to which they are bonded may also be a lactam having 5 to 8 ring atoms, where R 5 and R 6, together with the nitrogen atom to which they are bonded, may also be a five- to seven-membered heterocycle, d) optionally at least one further free-radically polymerizable monomer d) different from a), b) and c). a) at least one α,β-ethylenically unsaturated monomer a) of the general formula I where R 14 and R 15, independently of one another, are selected from the group consisting of hydrogen, C1-C8 linear- or branched-chain alkyl, methoxy, ethoxy, 2-hydroxyethoxy, 2-methoxyethoxy and 2-ethoxyethyl, R 17 is hydrogen or methyl, R 18 is alkylene or hydroxyalkylene having 1 to 24 carbon atoms, optionally substituted by alkyl, preferably C 2 H 4, C 3 H 6, C 4 H 8, CH 2 -CH -CH 2, g is 0 or 1, Z is nitrogen when g = 1 or oxygen when g = 0, R 25 and R 26 are in each case and independently of one another selected from the group consisting of hydrogen, C1-C40 linear- or branched-chain alkyl, formyl, C1-C10 linear- or branched-chain acyl, N,N-dimethylaminoethyl, 2-hydroxyethyl, 2-methoxyethyl, 2-ethoxyethyl, hydroxypropyl, methoxypropyl, ethoxypropyl or benzyl, where at least 60 mol% of a) have at least one quaternary nitrogen atom, b) at least one α,β-ethylenically unsaturated monomer b) of the general formula II where R 1 to R 3, independently of one another, are hydrogen, C 1 -C 4 -alkyl or phenyl; c) at least one α,β-ethylenically unsaturated monomer c) of the general formula III where one of the radicals R 4 to R 6 is a group of the formula CH 2 =CR 7 - where R 7 = H or C 1 -C 4 -alkyl and the other radicals R 4 to R 6, independently of one another, are H, alkyl, cycloalkyl, heterocycloalkyl, aryl or hetaryl, where R 4 and R 5, together with the amide group to which they are bonded may also be a lactam having 5 to 8 ring atoms, where R 5 and R 6, together with the nitrogen atom to which they are bonded, may also be a five- to seven-membered heterocycle, one of the radicals R 4 to R 6 is a group of the formula CH 2 =CR 7 - where R 7 = H or C 1 -C 4 -alkyl and the other radicals R 4 to R 6, independently of one another, are H, alkyl, cycloalkyl, heterocycloalkyl, aryl or hetaryl, where R 4 and R 5, together with the amide group to which they are bonded may also be a lactam having 5 to 8 ring atoms, where R 5 and R 6, together with the nitrogen atom to which they are bonded, may also be a five- to seven-membered heterocycle, d) optionally at least one further free-radically polymerizable monomer d) different from a), b) and c).