Finding an object that is a combo shape

How would I go about finding a complex image which is a combination of a square and circle. This is an icon that would be on an engineering drawing and I am looking to detect jus these shapes. When I attempt to find just the rectangle it fails because it detects two rectangles because the circle bisects the larger square. I can use HoughCircles and it easily detects the circle but I need to somehow figure out that the circle is encompassed in the square.
example icon

traditionally, a Hough transform, but the “generalized” one in this case, detecting this composite shape specifically.

you could also try a HoG detector.

or train a neural network. that will probably be a “fully convolutional” one.