To be precise, if in a close packed structure (ccp or fcc) there are $n$ atoms or ions then the number of octahedral voids and tetrahedral voids will be $n$ and $2n$ respectively.
For example, there are 8 tetrahedral voids per unit cell of fcc structure $(Z_{\text{eff}}=4)$. If you divide the FCC unit cell into 8 small cubes then each small cube has 1 tetrahedral void located at its own body center. Thus, total number of TVs in a unit cell $= 8 = 2 \times Z_\text{eff}$
Now, again consider a CCP or FCC unit cell. The body centre of the cube is not occupied but it is surrounded by 6 atoms (4 in same plane, 1 above and 1 below). On joining these face centers, an octahedral void is formed. Thus, number of OV at body centre of the cube is 1.
Besides the body center, there is one OV at the center of each of the 12 edges. It is surrounded by 6 atoms, three belonging to the same cell unit (two on the corners and once on face center), and the three belonging to two adjacent unit cells.
Since, each edge of the cube is shared between four adjacent unit cells only one fourth of each void belongs to a particular unit.
Therefore, OV at body centre = 1
OV at the 12 edges of the cube and shared between four unit cells $= 12\times\frac{1}{4}=3$
Total number of OVs $= 1 + 3 = 4 = Z_\text{eff}$