cos it fits with the definition of what a fruit is:
1. the developed ovary of a seed plant with its contents and accessory parts, as the pea pod, nut, tomato, or pineapple.
2. the edible part of a plant developed from a flower, with any accessory tissues, as the peach, mulberry, or banana.
3. the spores and accessory organs of ferns, mosses, fungi, algae, or lichen.
even if the squash is used as a veg