Preheat oven to 350°. Cut squash in half lengthwise and remove seeds. Place the squash halves, cut side up, on a baking pan, then cover with foil and bake until tender when pierced with a fork, 20 to 30 minutes. Uncover and let sit until cool enough to handle, then use a spoon to scoop out the cooked squash from the peel. Mash with a fork. Measure out 1 cup of the squash and set aside any remaining for future use in soups or stews or freeze for future cakes.
Turn oven down to 325°. Butter an 8- by 8-in. baking pan and set aside.
In a small bowl, combine flour, allspice, cinnamon, nutmeg, baking powder, salt, baking soda, and pepper. Set aside.
With a mixer, cream together butter and brown sugar in a large bowl until smooth and a bit fluffy. Add eggs one at a time, beating for 30 seconds after each addition. Mix in vanilla.
Add half of the flour mixture to the butter mixture and stir to combine. Stir in the cup of mashed squash. Add remaining flour mixture and stir just enough to combine. Pour batter into prepared baking pan and bake until a toothpick inserted in the center comes out clean, 50 to 60 minutes. Serve plain or with a dusting of powdered sugar or a dollop of whipped cream.