Let $S = \{1, \dots, n\}$ be a space os states. $P$ irreducible means that $S$ has only one class. Let $A = (a_{ij})$ be a $n \times n$ matrix, where $a_{ij} = 1$, for all $i, j \in \{1, \dots, n\}$ and let $a = (1, \dots, 1)$.
Then $\pi$ is an invariant vector for $P$ if, and only if, $\pi (I - P +A) = a$ and if $P$ is irreducible, then $I - P +A$ is invertible.
If $\pi$ is invariant, $\pi P = \pi$. Then $\pi(I - P + A) = \pi - \pi + \pi A = \pi A = a$, as $\pi$ is a probability vector and $A$ is a matrix where all entries are equal to $1$.
Conversely, if $\pi (I - P + A) = a$, we have that $\pi - \pi P + a = a$. Thus, $\pi = \pi P$.
I am having some trouble to conclude that if $P$ is irreducible, then $I - P + A$ is invertible.
Suppose $x$ is a column vector such that $(I-P+A)x=0$. You need to show that $x$ is the zero vector. You have $x-Px+c\cdot a^t=0$, where $c:=\sum_i x_i$, and the superscript ${}^t$ denotes transpose. Pre-multiply repeatedly by $P$; after a little algebra you see that $x-P^n x+nc\cdot a^t=0$ for $n=2,3,\ldots$. Rearrange this to $nc\cdot a^t = P^n x-x$, and ask yourself what happens as $n\to\infty$.