Heat milk or cream in a saucepan until warm, not boiling
Whisk egg yolks with sugar until smooth and pale
Slowly pour the warm milk into the egg mixture while whisking constantly
Return the mixture to the saucepan
Cook over low heat, stirring constantly, until it thickens enough to coat the back of a spoon
Remove from heat immediately
Strain the custard through a fine sieve if needed
Stir in vanilla or other flavoring if desired
Cool the custard before serving or using in a recipe
