Applying prescribed (implicit) solutions to the linear system of equations

I have this $$\mathbf{A}\mathbf{X}=\mathbf{B}$$ linear system of equations where $$\mathbf{X}= \begin{bmatrix} X_1 & X_2 & X_3 & X_4 & X_5 & X_6 & X_7 & X_8 \end{bmatrix} ^T$$ On physical grounds, it is dictated that $$X_1=X_2$$ and $$X_3=X_4$$. So my question is how these two (implicit) constraints must be applied to the system of equations before solving it?

If it helps, $$\mathbf{A}$$ is symmetric.

Assuming $$\mathbf{A}= \begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} & a_{15} & a_{16} & a_{17} & a_{18} \\ a_{21} & a_{22} & a_{23} & a_{24} & a_{25} & a_{26} & a_{27} & a_{28} \\ a_{31} & a_{32} & a_{33} & a_{34} & a_{35} & a_{36} & a_{37} & a_{38} \\ a_{41} & a_{42} & a_{43} & a_{44} & a_{45} & a_{46} & a_{47} & a_{48} \\ a_{51} & a_{52} & a_{53} & a_{54} & a_{55} & a_{56} & a_{57} & a_{58} \\ a_{61} & a_{62} & a_{63} & a_{64} & a_{65} & a_{66} & a_{67} & a_{68} \\ a_{71} & a_{72} & a_{73} & a_{74} & a_{75} & a_{76} & a_{77} & a_{78} \\ a_{81} & a_{82} & a_{83} & a_{84} & a_{85} & a_{86} & a_{87} & a_{88} \end{bmatrix}$$ $$\mathbf{B}= \begin{bmatrix} b_{1} & b_{2} & b_{3} & b_{4} & b_{5} & b_{6} & b_{7} & b_{8} \end{bmatrix}^T$$ $$\mathbf{X}= \begin{bmatrix} x_1 & x_2 & x_3 & x_4 & x_5 & x_6 & x_7 & x_8 \end{bmatrix} ^T$$ to enforce that the solution be obtained such that $$x_1=x_2$$ and $$x_3=x_4$$, matrices $$\mathbf{A}$$ and $$\mathbf{B}$$ must be changed to $$\mathbf{A}'= \begin{bmatrix} a_{11} & 0 & a_{13} & 0 & a_{15} & a_{16} & a_{17} & a_{18} \\ -1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ a_{31} & 0 & a_{33} & 0 & a_{35} & a_{36} & a_{37} & a_{38} \\ 0 & 0 & -1 & 1 & 0 & 0 & 0 & 0 \\ a_{51} & 0 & a_{53} & 0 & a_{55} & a_{56} & a_{57} & a_{58} \\ a_{61} & 0 & a_{63} & 0 & a_{65} & a_{66} & a_{67} & a_{68} \\ a_{71} & 0 & a_{73} & 0 & a_{75} & a_{76} & a_{77} & a_{78} \\ a_{81} & 0 & a_{83} & 0 & a_{85} & a_{86} & a_{87} & a_{88} \end{bmatrix}$$ $$\mathbf{B}'= \begin{bmatrix} b_{1} & 0 & b_{3} & 0 & b_{5} & b_{6} & b_{7} & b_{8} \end{bmatrix}^T$$ Now, solving $$\mathbf{A}'\mathbf{X}=\mathbf{B}'$$ will lead to solution $$\mathbf{X}$$ such that $$x_1=x_2$$ and $$x_3=x_4$$.