I managed to solve it. Atleast for W10 and W11 24H2 for fastboot to recognize A40 and Pixel 5 you have to go into device manager and load the bootloader driver interface for the android device. After then fastboot should work normally.