How do would you model this ??
I made a video for you. You need to loft between the square and the octagon. the trouble you may be having is you will need to "show all connectors" by right clicking when you in the loft menu. Then you can drag the connectors around to get the desired shape. I hope this help.
link to youtube