Take note that a triangle is a polygon with three sides. While, a rectangle is a polygon with 4 sides and 4 angles that measure 90 degrees. One example that has a top view of a triangle and a side and front view that are each rectangles is a box of a chocolate toblerone. You can refer on the image below.
You may come to your mind that a roof is one example, however, be careful about that because the top view of a roof is not a triangle. You can refer on the image that I included below.
Think about the roof of a pizza hut. the top is a rectangle with trapezoid sides. For your example, a roof of a house is the best idea. Also a piece of cake. From the side view it looks like a rectangle, but on top it looks like a triangle.