Cream the butter, sugars, egg yolks, custard powder and vanilla. Add the flour and mix to form a dough. Wrap the dough in cling-film and freeze for 30 minutes.
Preheat oven to 180 C / 160 C fan / Gas 4. Grease and line 2 large baking trays.
Remove the dough from the freezer and roll out thinly and evenly on a non-stick surface. Working quickly, and try not to handle the dough, to stop the dough turning sticky.
Cut the cookies out using a cookie cutter (e.g. round or rectangular). Make sure the cookies are all the same thickness. Place cookies on baking trays, leaving 1cm between each one.
Bake in the preheated oven for 8 to 12 minutes or until light golden brown. If some cookies are browning more quickly than others then these may be thinner than the rest, you could try turning them in the oven to cook evenly. Remove from the oven and allow to cool completely on a cooling rack.
For the cream filling:
Cream together the butter, icing sugar and custard powder until thick and creamy. Pipe filling on alternate cookies and sandwich together and leave to set. Store in a dry, air-tight container.
For chocolate cream cookies change the custard powder to cocoa powder.