Heat the oven to gas 4, 180°C, fan 160°C. Grease and base line three 20cm sandwich tins.
Put 180g of the butter into a bowl with 180g of caster sugar, 180g flour, 3 eggs, 2 tsp vanilla extract and 20ml milk. Beat, using a hand-held electric mixer, until light and creamy.
Divide the mixture equally between three bowls. Add red food colour to the first bowl, orange to the second and yellow to the third. Add only ¼ tsp of colour at a time until you reach the desired shade. Mix well. Pour each bowl of sponge mix into a prepared tin and spread to level. Bake all three in the oven for 12–15 mins, or until firm to the touch. Turn onto a wire rack to cool.
Using the remaining cake ingredients, repeating the process to make three more sponges. Colour these green, blue and violet.
To make the icing, put the butter and cream cheese into a bowl and beat until smooth. Add half the icing sugar and mix well. Then, add the remaining icing sugar and beat until smooth.
Place the violet sponge on a cake board or plate and spread with a little icing. Place the blue sponge on top. Continue layering this way, following the colours of the rainbow. Spread a thin layer of icing around the sides of the cake and chill until firm.
Spread the remaining icing over the top and sides of the cake. Chill until firm.