A landscaper has two gardens: one is a square and the other is a rectangle. The width of the rectangular garden is 5 yards less than a side of the square one, and the length of the rectangular garden is 3 yards more than a side of the square garden. If the sum of the areas of both gardens is 165 square yards, find the measure of a side of the square garden.