Set aside about 6 tablespoons of the milk. Pour the rest into a saucepan and bring to the boil with the vanilla and the sugar.
Meanwhile, whisk the egg yolks with the flour until pale yellow and thick. Gradually add the reserved 6 tablespoons cold milk, stirring constantly, then slowly pour in the hot milk, still stirring. Strain this mixture back into the saucepan that contained the milk. Bring back to the boil, stirring continuously, and cook slowly until thickened. Transfer to a clean bowl or jug and use as required.