Add the sherry or Madeira and brandy and beat on low speed until incorporated, then beat on medium-high speed until the mixture is smooth and fluffy, 1 to 2 minutes.
Working with a stand mixer, preferably fitted with a paddle attachment, or with a hand mixer in a large bowl, beat the butter and sugar together at medium speed for 3 minutes, until very smooth.