Entropy is a property of the system. The change in entropy of a system as it traverses from an initial state(1) to a final state(2) is independent of the path by which the system is taken from state 1 to state 2. The path can be a reversible one, or even irreversible, the change in entropy is always the same as long as the initial and final states are the same. However, in order to calculate the change in entropy $S_{2}-S_{1}$, one has to connect a reversible path between the two states because $\displaystyle S_{2}-S_{1}=\int_{1}^{2}\frac{dQ_{rev}}{T}$, where $dQ_{rev}$ is an infinitesimal amount of heat transferred to the system in a reversible manner at the system temperature T. NOTE: $\displaystyle\int_{1}^{2}\frac{dQ_{irrev}}{T}$ is not the correct formula for calculating the change in entropy. It is always $\displaystyle\int_{1}^{2}\frac{dQ_{rev}}{T}$ irrespective of whether the path is reversible or irreversible.
Entropy $S$ is a state function.
It only depends on the final and initial states, and not on how the state was reached.
The Clausius' Inequality states
$$\oint \frac{đQ_\textrm{system}}{T_\textrm{source}}\leqq 0\,.\tag{I }$$
When the cycle is reversible, $T_\textrm{source}~=~ T_\textrm{system}$ and equality of $\rm(I)$ applies i.e.,
$$\oint \frac{đQ_\textrm{system}}{T_\textrm{system}} = 0\tag{I.i}$$
It is a matter of few steps from $\rm(I.i)$ to show that the integral $\displaystyle\int \dfrac{đQ}{T}$ takes the same value for two different reversible paths.
So, we can define $S(\rm A) = \displaystyle\int_{\rm O_\textrm{reference state}}^{\rm A}~ \dfrac{đQ_\textrm{rev}}{T_\textrm{system}}$ i.e., for a reversible transformation.
Now, consider two paths equilibrium states $\rm A$ and $\rm B$ such that $\mathsf I$ connecting $\rm A$and $\rm B$ is arbitrary path (reversible or irreversible) and the second path $\mathsf I^\prime$ connecting $\rm B$ and $\rm A$ is reversible.
So, using $\rm(I),$ we get
$$\begin{align} \oint_{\mathrm A \mathsf I \mathrm B \mathsf{^\prime}\mathrm A } \frac{đQ}{T} & \leqq 0 \\ \implies~~~~~~~~~~~~~~~ \left (\int_{\mathrm A}^{\mathrm B} \frac{đQ}{T}\right)_{\mathsf{I}} + \left (\int_{\mathrm B}^{\mathrm A} \frac{đQ}{T}\right)_{\mathsf{I^\prime}} & \leqq 0\\\implies \left (\int_{\mathrm A}^{\mathrm B} \frac{đQ}{T}\right)_{\mathsf{I}} - \left[\int_{\mathrm O}^{\mathrm B}\frac{đQ}{T}-\int_{\mathrm O}^{\mathrm A} \frac{đQ}{T}\right]&\leqq 0~~~~~~~~~~~~~~~~~~~~~(\mathsf I^\prime~\textrm{is reversible})\\ \implies~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ S(\mathrm B)- S(\mathrm A)&\geqq \left (\int_{\mathrm A}^{\mathrm B} \frac{đQ}{T}\right)_{\mathsf{I}}\tag{II}\end{align}$$
From $\rm (II)$
$$S(\mathrm B)-S(\mathrm A)~=~\left (\int_{\mathrm A}^{\mathrm B} \frac{đQ}{T}\right)_{\mathsf{I}}~~~\textrm{iff}~~~\mathsf I ~\textrm{is a reversible transformation}$$ that is, $$S(\mathrm B)-S(\mathrm A)~=~\int_{\mathrm A}^{\mathrm B} \frac{đQ_\textrm{rev}}{T}\tag{III.i}$$
When $\sf{ I}$ is irreversible, then from $\rm{(II)}$
$$S(\mathrm B)-S(\mathrm A)\gt \int_{\mathrm A}^{\mathrm B} \frac{đQ_\textrm{irrev}}{T}$$
More precisely, using the first law $$\mathrm dS= \dfrac{\textrm{đ} q_\textrm{irrev}}{T}+ \dfrac{\left [ \textrm{đ} w_\textrm{rev}-\textrm{đ} w_\textrm{irrev}\right]}{T}\;.\tag{III.ii}$$
Both $\rm{(III.i)}$ and $\rm{(III.ii)}$ would yield the same entropy change as after-all entropy $S$ is a state function.
But which of $\rm{(III.i)}$ and $\rm{(III.ii)}$ would one use to compute the change in entropy?
Think.
References:
$\bullet$ Thermodynamics by Enrico Fermi.
Best Answer
It is a standard practice in textbook thermodynamics analyses to tacitly equip the surroundings with equipment that does not generate entropy during a process. One such piece of equipment is the so-called ideal constant temperature reservoir. The fluid in such a reservoir is assumed to have an infinite mass times heat capacity so that the temperature of the fluid remains virtually constant when it exchanges heat with the system. For such an ideal reservoir, the key operating characteristic is that its entropy change is equal to the heat it receives from the system $Q_{res}$ divided by its absolute temperature (irrespective of any irreversible entropy generation within the system):$$\Delta S_{res}=\frac{Q_{res}}{T_{res}}$$
The "ideal constant temperature reservoir" describes the limiting behavior of any finite thermal capacity reservoir, for which $$\Delta S=\int_{T_i}^{T_f}{mC\frac{dT}{T}}=mC\ln{(T_f/T_i)}$$ with $$Q=mC(T_f-T_i)$$where $T_i$ and $T_f$ are the temperatures in the initial and final thermodynamic equilibrium states of the reservoir and Q is the actual amount of heat received by the reservoir in the irreversible process.
If we combine these two equations, we obtain: $$\Delta S=mC\ln{\left(1+\frac{Q}{mCT_i}\right)}$$In the limit of mC becoming infinite, this reduces to:$$\Delta S=\frac{Q}{T_i}$$
I should also mention that the fluid within the ideal constant temperature reservoir is assumed to have either an infinite thermal conductivity or is extremely well-mixed, such that the temperature throughout the reservoir is uniform spatially at $T_{res}$, including (and specifically) at the interface with the "system."