If $R$ and $S$ are two rectangles with integer sides such that the perimeter of $R$ equals the area of $S$ and the perimeter of $S$ equals the area of $R$, then we call $R$ and $S$ a friendly pair of rectangles. Find all friendly pairs of rectangles.
1. Let the sides of rectangle \( R \) be \( a \) and \( b \), and the sides of rectangle \( S \) be \( c \) and \( d \). Given that the perimeter of \( R \) equals the area of \( S \) and the perimeter of \( S \) equals the area of \( R \), we have the following equations:
   \[
   2(a + b) = cd \quad \text{(1)}
   \]
   \[
   2(c + d) = ab \quad \text{(2)}
   \]

2. Without loss of generality, assume \( a \geq b \) and \( c \geq d \). From equation (1), we can express \( cd \) in terms of \( a \) and \( b \):
   \[
   cd = 2(a + b)
   \]

3. From equation (2), we can express \( ab \) in terms of \( c \) and \( d \):
   \[
   ab = 2(c + d)
   \]

4. Multiply both equations:
   \[
   (cd)(ab) = 4(a + b)(c + d)
   \]
   \[
   abcd = 4(a + b)(c + d)
   \]

5. Since \( a \geq b \) and \( c \geq d \), and assuming \( b \geq d \), we have:
   \[
   abcd \leq 4(a + a)(c + c) = 16ac
   \]
   \[
   bd \leq 16
   \]
   \[
   d^2 \leq bd \leq 16 \implies d \leq 4
   \]

6. We now consider the possible values of \( d \) (i.e., \( d = 1, 2, 3, 4 \)) and solve for \( a \), \( b \), and \( c \).

7. For \( d = 1 \):
   \[
   2(c + 1) = ab \quad \text{and} \quad 2(a + b) = c
   \]
   \[
   (a - 4)(b - 4) = 18
   \]
   Possible solutions:
   \[
   (a, b) = (22, 5), (13, 6), (10, 7)
   \]
   Corresponding \( c \) values:
   \[
   c = 54, 38, 34
   \]

8. For \( d = 2 \):
   \[
   2(c + 2) = ab \quad \text{and} \quad 2(a + b) = 2c
   \]
   \[
   (a - 2)(b - 2) = 8
   \]
   Possible solutions:
   \[
   (a, b) = (10, 3), (6, 4)
   \]
   Corresponding \( c \) values:
   \[
   c = 13, 10
   \]

9. For \( d = 3 \):
   \[
   2(c + 3) = ab \quad \text{and} \quad 2(a + b) = 3c
   \]
   \[
   (3a - 4)(3b - 4) = 70
   \]
   Possible solutions:
   \[
   (a, b) = (6, 3)
   \]
   Corresponding \( c \) values:
   \[
   c = 6
   \]

10. For \( d = 4 \):
    \[
    2(c + 4) = ab \quad \text{and} \quad 2(a + b) = 4c
    \]
    \[
    (a - 1)(b - 1) = 9
    \]
    Possible solutions:
    \[
    (a, b) = (4, 4)
    \]
    Corresponding \( c \) values:
    \[
    c = 4
    \]

Therefore, all solutions are:
\[
\{\{a, b\}, \{c, d\}\} = \{\{22, 5\}, \{54, 1\}\}, \{\{13, 6\}, \{38, 1\}\}, \{\{10, 7\}, \{34, 1\}\}, \{\{10, 3\}, \{13, 2\}\}, \{\{6, 4\}, \{10, 2\}\}, \{\{6, 3\}, \{6, 3\}\}, \{\{4, 4\}, \{4, 4\}\}
\]

The final answer is \( \boxed{ \{\{22, 5\}, \{54, 1\}\}, \{\{13, 6\}, \{38, 1\}\}, \{\{10, 7\}, \{34, 1\}\}, \{\{10, 3\}, \{13, 2\}\}, \{\{6, 4\}, \{10, 2\}\}, \{\{6, 3\}, \{6, 3\}\}, \{\{4, 4\}, \{4, 4\}\} } \)