Before you start, remove the butter from the fridge and allow to come up to room temperature.
Preheat the oven to 190ºC/375ºF/gas 5. Grease two springform cake tins (roughly 20cm) with butter, then line the bottom with greaseproof paper and dust the sides with gluten-free flour.
In a bowl, beat the butter and sugar for around 5 minutes, or until light and fluffy. Crack in the eggs, then mix in the vanilla extract until combined. Sieve the flour, baking powder, xanthan gum and cocoa powder into the bowl, then fold through. Add the milk and stir briefly until you have a nice, smooth batter.
Carefully divide the mixture between the cake tins, then place on the middle shelf of the hot oven for 15 to 20 minutes, or until an inserted skewer comes out clean. Leave to cool for 5 minutes, before turning the cakes out onto a wire cooling rack, then leave to cool completely while you make the icing.
Sieve the icing sugar and cocoa powder into a large bowl, then add the butter and beat until smooth. Stir in the cream cheese until combined. If it’s a little thick, add a splash of milk to loosen.
Once cooled, place one of the sponges on a plate or cake stand. Carefully spread over half the butter icing. In a bowl, crush the raspberries with a fork, then scatter on top. Sandwich the second sponge on top and press down slightly, then carefully spread over the remaining icing and finish with a few shavings of chocolate.