1 Introduction

General relativity (GR) is the most successful gravity theory for more than 100 years, almost universally accepted and well confirmed by scrutiny and testing [1]. Nevertheless, there are a number of unsolved problems of GR both from a theoretical and observational point of view (see Ref. [2]) and thereby a number of alternative models have been proposed. Moreover, the current versions of string theory require 10 dimensions total or 11 if you take an extended version known as M-Theory. However, the existence of extra spacetime dimensions beyond the four was initiated by Kaluza [3] and Klein [4], and now it is known as Kaluza–Klein theory. In this context, Lovelock (or referred to as Lanczos–Lovelock) [5, 6] higher-curvature gravity theory is rather special. In particular, Lovelock theory is the most natural extension of GR in higher dimensional spacetimes while keeping the order of the field equations down to second order in derivatives without torsion. A notable fact is that such theory is known to be free of ghosts [7, 8] when considering perturbations around flat spacetime.

Among all the classes of Lovelock theory of gravity, the simplest non-trivial Lovelock gravity is the so-called Einstein–Gauss–Bonnet (EGB) gravity, whose Lagrangian is the sum of the curvature scalar with a cosmological constant, while the third term contains the quadratic Gauss–Bonnet (GB) term. The EGB gravity has been widely studied because it is realized in the low-energy limit for strings propagating in curved spacetime [9, 10]. In this theory, the static and spherically symmetric black hole solution was found by Boulware and Deser [11]. However, in 4D spacetime, the GB term is a topological invariant and thus does not contribute to the gravitational dynamics, except it is coupled to a matter field [12, 13].

But, recently an interesting observation has been put forward in reformulating the EGB gravity in 4D spacetime such that a non-vanishing effect of the GB Lagrangian can emerge. The basic idea was to rescale the GB coupling constant \(\alpha \rightarrow \alpha /(D -4)\) because the presence of an overall factor \((D-4)\) will cancel out, and then taking the limit \(D \rightarrow 4\) [14]. This idea is known to be 4D EGB theory and the GB term produces non-trivial contributions to gravitational dynamics. Such a theory would bypass the conclusions of Lovelock’s theorem and avoid the Ostrogradsky instability [15]. Research on 4D EGB gravity broadened rapidly among the scientific community, such as black hole solutions [16,17,18,19,20,21,22,23], a Vaidya-like radiating black hole in Ref. [24], black holes coupled to magnetic charge and nonlinear electrodynamics [25, 26] and charged black hole [27, 28]. Furthermore, deflection of light by black holes [29,30,31], weak cosmic censorship conjecture [32], quasi-normal modes [33,34,35] and shadow cast by black holes [36,37,38,39] have been fully investigated. A comprehensive analysis about stellar structure models within this framework have been exhaustively studied, see for example [40,41,42,43]. Wormhole and thin-shell wormholes have been studied as well [44, 45].

Associated with the success of this theory there are several criticisms against this model. The most important issue is that despite the fact that the Lagrangian has an overall factor \(D-4\), this is not the case for the equation of motion. Therefore, the whole limiting procedure was cast in doubt [46,47,48,49]. As a result, some proposals have been raised to circumvent the aforementioned shortcomings, but possessing some of the flavor of the original idea. With an additional scalar degree of freedom the regularized theories help us to obtain the field equations in a 4D version, for example Kaluza–Klein-reduction procedure of the higher-dimensional EGB theory [50, 51], conformally invariant scalar field equation of motion [52,53,54], and ADM decomposition analysis [55]. Thus, it reflects that regularized procedures are not unique. It is however worthwhile to remark that spherically-symmetric 4D solutions still remain valid in these regularized theories [41] as of original prescription presented in [14].

In considering alternative theories of gravity it is necessary to pass constraints obtained from the classical tests of GR at an observational and theoretical level. The best way to check the viability of this theory one may start from strong-field regime [56]. With this point of view compact astrophysical objects, such as neutron stars (NSs), can be considered suitable test-beds in the strong-field regime. NSs are considered to be the most ideal astrophysical laboratories for dense nuclear matter that end their life cycles of massive stars \(8 M_{\odot } \lesssim M \lesssim 25 M_{\odot }\) via supernova explosions. The observations made over the electromagnetic spectrum suggest that NSs can have mass between 1–2 \(M_{\odot }\) with radius between 10–15 km [57, 58]. As a result, in a narrow range the central densities are several times higher than nuclear saturation density i.e., \(\rho \gtrsim \rho _{\text {nuc}} \) where \(\rho _{\text {nuc}} = 2.8 \times 10^{14}~\hbox {g}/\hbox {cm}^3\). Such extreme conditions make it impossible to deal with this type of matter in a laboratory conducted on Earth, and thus we are far away from the comprehensive picture of their internal structure.

On the other hand, measurements of the masses or radii have put a strong constraint on the equation of state (EoS) governing these compact objects, and consequently the interior composition also. For this reason, physicists predict different types of effective models (exotic matter with large strangeness fraction) in order to extract their bulk properties and reveal how matter behaves in their interior. For instance, “exotic matter” such as a Bose–Einstein condensate of negative pions (\(\pi ^{-}\)) or negative kaons (\(K^{-}\)), hot quark-gluon plasma and even cold quark matter are now so widely discussed that they are familiar concepts. Among them quark matter in the core of compact objects might be absolutely stable and thus the true ground state of hadronic matter [59, 60]. This possibility was first realized by Witten [60] and Bodmer [61] that compact stars are partially or totally made of quarks. Even more intriguing the existence of a quark core in a NS is constituted of almost equal numbers of up, down and strange quarks, and a small number of electrons to attain the charge neutrality. Such compact stars have been called strange quark stars (SQS) (shortened as strange stars) and the MIT-bag model is one of the most successful ones for quark confinement. We will discuss below more about MIT-bag model.

So far most of the studies have performed under the assumption of charge neutrality inside a spherical surface. But, the breakthrough came from several researchers [62, 63]. Moreover, the existence of SQS ought to be made of chemically equilibrated strange matter, and it requires the presence of electrons inside strange stars [64]. In such a system, electrons play an important role in producing repulsive force which will add up to the internal pressure allowing more repulsive force of the system. In 1924, Rosseland [65] first pointed out the possibility of existing of a self-gravitating star with non-vanishing net charge where the star is modeled by a ball of hot ionized gas. Currently, there are couple of articles showing the existence of charged stars [66, 67]; however, the charge can be as high as \(10^{20}\) Coulomb to bring any significant effect on the mass–radius relation [68]. This situation has been verified by Ray et al. [69] (see Ref. [70] for a more detailed discussion).

In recent progress, Ivanov [71] assumed a linear EoS to study charged perfect fluid solutions. Motivated by this results, several authors have studied electrically charged fluid spheres for linear and non-linear EoS [72,73,74,75,76]. Motivated by MIT bag models of strange stars, charged solutions were studied by some authors [77, 78]. Studies on the stability of charged fluid spheres against radial perturbation have been done in Ref. [77]. For in depth discussions about the stability of charged spheres have been found in [79,80,81,82]. In Ref. [64], authors showed that the electric charge distribution can have a significant impact on the structure of QSs. A large number of analytic solutions to the Einstein-Maxwell system were also investigated in Refs. [83,84,85].

In light of these fantastic results, in this paper, we will study the effect of electric charge on compact stars assuming the MIT bag model EoS. We consider the internal structure and their physical properties for a specific classes of QSs in the recently proposed 4D EGB gravity theory. To do so, in Sect. 2, we present the field equations for Einstein–Maxwell–Gauss–Bonnet theory and we derive the modified Tolman–Oppenheimer–Volkoff (TOV) equations describing the star interior for a static and spherically symmetric system. In Sect. 3, we define the appropriate boundary conditions for interior and exterior spacetime in order to solve the stellar structure equations. In Sect. 4 we discuss the EoS concerning MIT-bag quark model. To simplify our calculation we assume that charge density is proportional to the energy density. In this context, we continue our discussion for numerical findings specially focusing on the mass–radius relation and the stability of hydrostatic equilibrium in Sect. 5. Finally, our conclusions are reported in Sect. 6. We adopt a geometric unit system, however, we show our results in physical units for comparison purposes.

2 Basic construction of charged stellar model in 4D EGB gravity

We start from the action of the Einstein–Maxwell–Gauss–Bonnet theory in 4D spacetime introduced in Ref. [14] after the rescaling of Gauss–Bonnet constant \(\alpha \). Expressed in an explicit manner, the action in D spacetime takes the following form,

$$\begin{aligned} {\mathcal {I}}_{A}= & {} \frac{1}{16 \pi G}\int d^{D}x\sqrt{-g}\left[ R +\frac{\alpha }{D-4} {\mathcal {G}} \right] \nonumber \\&+ \int d^{D}x\sqrt{-g} {\mathcal {L}}_m, \end{aligned}$$
(1)

where \(\alpha \) is a coupling constant with dimensions of length squared and the Gauss–Bonnet invariant is defined as

$$\begin{aligned} {\mathcal {G}} = R^{\mu \nu \rho \sigma } R_{\mu \nu \rho \sigma }- 4 R^{\mu \nu }R_{\mu \nu }+ R^2, \end{aligned}$$
(2)

where \(R_{\mu \nu \rho \sigma }\) is the Riemann curvature tensor, \(R_{\mu \nu }\) is the Ricci curvature tensor and \(R^{2}\) is the squared of the scalar curvature.

The field equations in D dimensional spacetime can be obtained from variation of the action (1) with respect to metric tensor \(g_{\mu \nu }\), namely

$$\begin{aligned} R_{\mu \nu }-\frac{1}{2}R~ g_{\mu \nu }+\frac{\alpha }{D-4} H_{\mu \nu }= 8 \pi T_{\mu \nu }, \end{aligned}$$
(3)

where \(H_{\mu \nu }\) is the Lanczos tensor with the following expressions

$$\begin{aligned} H_{\mu \nu }= & {} 2\Bigr ( R R_{\mu \nu }-2R_{\mu \sigma } {R}{^\sigma }_{\nu } -2 R_{\mu \sigma \nu \rho }{R}^{\sigma \rho } - R_{\mu \sigma \rho \delta }{R}^{\sigma \rho \delta }{_\nu }\Bigl ) \nonumber \\&- \frac{1}{2}~g_{\mu \nu }~{\mathcal {L}}_{\text {GB}}, \end{aligned}$$
(4)

and \(T_{ \mu \nu }\) is the energy–momentum tensor of the matter field and which can be calculated by

$$\begin{aligned} T_{ \mu \nu } =-\frac{2}{\sqrt{-g}}\frac{\delta (\sqrt{-g}{\mathcal {L}}_{ m})}{\delta g^{ \mu \nu }}. \end{aligned}$$
(5)

The third term on the left-hand side of Eq. (3) is the quadratic Gauss–Bonnet term with the property that it contains at most second-order derivatives. As a result, the above theory has a non-trivial contribution to the gravitational dynamics by taking the limit \(D \rightarrow 4\).

In the present study we assume that the energy–momentum tensor \(T_{\mu \nu }\) is a sum of two terms, i.e. \(T_{\mu \nu }= E_{\mu \nu } + M_{\mu \nu }\) in Eq. (3). The first part \(E_{\mu \nu }\) associates with electromagnetic energy–momentum tensor,

$$\begin{aligned} E_{\mu \nu }=\frac{1}{4\pi }\left( F_{\mu }^{\gamma }F_{\nu \gamma }- \frac{1}{4}g_{\mu \nu } F_{\gamma \beta }F^{\gamma \beta }\right) . \end{aligned}$$
(6)

where \(F_{\mu \nu }\) is the electromagnetic tensor. The electromagnetic field satisfies the Maxwell equations:

$$\begin{aligned} \left[ \sqrt{-g} F^{\mu \nu } \right] _{,\nu } = 4\pi j^\mu \sqrt{-g}. \end{aligned}$$
(7)

The electromagnetic D-current is given by \(j^{\mu } = \rho _{ch} u^{\mu }\), where \(\rho _{ch}\) is the electric charge density. Moreover, the tensor term \(M_{\mu \nu }\) corresponds to an isotropic perfect fluid, whose energy–momentum tensor has the following form

$$\begin{aligned} M_{\mu \nu }=(\rho + P)u_{\mu }u_{\nu }+ Pg_{\mu \nu }, \end{aligned}$$
(8)

where P is the pressure, \(\rho \) the energy density of matter, and \(u_{\nu }\) is the D-velocity of the fluid satisfying the normalization condition \(u_{\nu }u^{\nu } = -1\).

For our purpose, we consider a static and spherically symmetric metric describing the interior spacetime of a compact star in D dimensions, namely

$$\begin{aligned} ds^2_D = - e^{2\Phi (r)}dt^2 + e^{2\lambda (r)} dr^2 + r^2d\Omega ^2_{D-2}, \end{aligned}$$
(9)

where \(d\Omega ^2_{D-2}\) represents the metric on the surface of the \((D-2)\)-sphere, given by

$$\begin{aligned} d\Omega ^2_{D-2} =&\ d\theta _1^2 + \sin ^2\theta _1d\theta _2^2 + \sin ^2\theta _1\sin ^2\theta _2 d\theta _3^2 \nonumber \\&+ \cdots + \left( \prod _{j=1}^{D-3} \sin ^2\theta _j \right) d\theta _{D-2}^2, \end{aligned}$$
(10)

with the metric functions \(\Phi \) and \(\lambda \) depending on r alone. For this line element it also follows that the only non-vanishing component of the Maxwell strength tensor is \(F^{01} = -F^{10}\), and which is a function of r, only. The other components of electromagnetic tensor are identically zero. Consequently, Maxwell’s Eq. (7) leads to the following expression

$$\begin{aligned} E(r) = F^{01}(r) =\frac{4\pi }{r^2} e^{-(\Phi +\lambda )} \int ^r_0r^{D-2} e^{\lambda } {\rho _{ch}} ~dr , \end{aligned}$$
(11)

and hence the electric charge within a sphere of radius r can be written in a suggestive form by defining the charge function q(r) as

$$\begin{aligned} \frac{d q(r)}{dr} = 4 \pi r^{D-2} \rho _{ch} e^{\lambda }. \end{aligned}$$
(12)

In the limit \(D \rightarrow 4\), combining the line element (9) together with the energy–momentum tensors (6) and (8), the 00 and 11 components of the field equations (3) can be explicitly written as

$$\begin{aligned}&\frac{\alpha (1-e^{-2\lambda })}{r^3}\left[ 4\lambda ' e^{-2\lambda }-\frac{(1-e^{-2\lambda })}{r}\right] \nonumber \\&\quad +e^{-2\lambda }\left( {2\lambda ' \over r}-{1\over r^2}\right) + {1\over r^2} = 8 \pi \Big ( \rho +{q^2 \over 8\pi r^{4}}\Big ), \end{aligned}$$
(13)
$$\begin{aligned}&\frac{\alpha (1-e^{-2\lambda })}{r^3}\left[ 4\Phi ' e^{-2\lambda }+\frac{(1-e^{-2\lambda })}{r}\right] \nonumber \\&\quad +e^{-2\lambda }\left( {2\Phi ' \over r}+{1\over r^2}\right) -{1\over r^2}= 8 \pi \Big ( P- {q^2 \over 8\pi r^{4}}\Big ). \end{aligned}$$
(14)

In addition, the covariant conservation of the energy–momentum tensor, which can be derived from the contracted Bianchi identities (i.e., \(\nabla _{\mu }T^{\mu \nu } \) = 0), provides

$$\begin{aligned} \frac{dP}{dr} = - (\rho + P) \frac{d\Phi }{dr}+\frac{q q'}{4 \pi r^4}. \end{aligned}$$
(15)

In order to solve this set of differential equations, one begins with a more familiar form of mass function m(r) through the following relation

$$\begin{aligned} e^{-2\lambda } = 1+\frac{r^2}{2\alpha } \left[ 1-\sqrt{1+4\alpha \left( \frac{2m}{r^3} - \frac{q^2}{r^4}\right) }\right] . \end{aligned}$$
(16)

Note that in the limit \(\alpha \rightarrow 0\) or large r, the solution (16) behaves asymptotically as

$$\begin{aligned} \lim _{\alpha \rightarrow 0} e^{-2\lambda } = 1-\frac{2m}{r}+\frac{q^2}{r^2}+\frac{(q^2-2mr)^2}{r^6}\alpha + \cdots . \end{aligned}$$
(17)

We can now rewrite Eq. (13) in terms of the mass parameter m(r), this is,

$$\begin{aligned} \frac{dm}{dr} = 4\pi r^2 \rho +\frac{q}{ r}\frac{dq}{dr} , \end{aligned}$$
(18)

which clearly exhibits the same as the corresponding equations in GR, and without influence of coupling constant \(\alpha \), as measured in the star’s frame.

Finally, the substitution of Eq. (12) and the conservation equation (15) into Eq. (14), it yields

$$\begin{aligned} {dP \over dr}= & {} \frac{(P +\rho ) \left[ r^3 \left( \Lambda + 8\pi \alpha P - 1\right) - 2\alpha m \right] }{r^2 \Lambda \left[ r^2 \left( \Lambda - 1\right) - 2\alpha \right] } \nonumber \\&+\frac{q}{4 \pi r^4} \frac{dq}{dr}, \end{aligned}$$
(19)

where

$$\begin{aligned} \Lambda ^2 \equiv 1+4\alpha \left( \frac{2 m}{r^3}-\frac{q^2}{r^4}\right) . \end{aligned}$$
(20)

Equation (19) is the modified TOV equation, describing the hydrostatic equilibrium of relativistic stars in 4D EGB theory. Note that when \(\alpha \rightarrow 0\) the above equation reduce to the TOV equation for electrically charged fluid spheres in GR.

We arrive at six unknown functions, namely, \(\Phi (r)\), m(r), q(r), \(\rho (r)\), P(r) and \(\rho _{ch}(r)\), with four differential equations: (12), (15), (18) and (19). Therefore, we need a suitable assumption that reduces the number of unknown functions, see for instance some prescriptions in Refs. [77, 86] for charged fluid spheres in GR. In the following discussion we are free to specify two of the six unknowns; in this treatment we assume an EoS relating the pressure with the energy density of the fluid, and then a relation between the charge distribution and the mass density. Using this assumption we are able to solve the structure equations numerically with some appropriate boundary conditions. We should remark that the metric potential \(\lambda (r)\) is then determined by means of Eq. (16).

3 Boundary conditions and the exterior vacuum region to the star

To get a stellar structure, we perform a numerical integration from the center at \(r= 0\) toward the surface of the star where the pressure vanishes (i.e., when \(P(r =R) = 0\)). In that regard, we need to establish appropriate boundary conditions for the sought solutions. As already mentioned, given an EoS and a charge density profile, the unknown variables to be determined are m, q and \(\rho \) through Eqs. (12), (18) and (19). Accordingly, we must set the following boundary conditions to maintain regularity at the origin,

$$\begin{aligned} m(r=0)&= 0,&q(r=0)&= 0,&\rho (r=0)&= \rho _c, \end{aligned}$$
(21)

where \(\rho _c\) is the central energy density. Thus, a set of specific values of \(\rho _c\) allows us to obtain a family of compact stars in 4D EGB gravity.

Furthermore, to compute the metric function \(\Phi \), one needs an additional boundary condition in order to solve Eq. (15). This means that, at the surface of the charged star, the inner and outer potential functions are related through the equality:

$$\begin{aligned} e^{2\Phi (R)}&= e^{-2\lambda (R)} \nonumber \\&= 1+\frac{R^2}{2\alpha } \left[ 1-\sqrt{1+4\alpha \left( \frac{2 M}{R^3}-\frac{Q^2}{R^4}\right) }\right] , \end{aligned}$$
(22)

with \(M = m(r=R)\) and \(Q = q(r=R)\) being the total mass and the total charge of the star, respectively. The outer solution corresponds to the Reissner–Nordström spacetime, if we take the limit \(\alpha \rightarrow 0\) [27].

4 Equation of state for quark matter and the charge density profile

4.1 Equation of state

In this section, we discuss the quark matter model that we are going to use in our analysis. The EoS of quark matter plays a crucial role for determining the star’s structure at supranuclear density (above the nuclear density: \(\rho _\mathrm{nuc} = 2.8 \times 10^{14}~\mathrm{g}/\mathrm{cm}^3\)) and high temperature (\(T \sim 10 ~\mathrm{MeV}\)). Its great success at very high energies has triggered many theoretical investigations both on the modeling of the EoS of quark matter which incorporate basic features of Quantum Chromodynamics (QCD) and on the phenomenological implications related to measurements of masses and radii of compact stars. However, we are still far away from the exact EoS of quark matter.

As a consequence, the MIT bag model is the simplest phenomenological model for quark matter. Such model has been developed to describe hadron properties in terms of quarks. The range in which quarks are confined is called a bag and the energy per unit volume to form it is called a bag pressure, \( \mathrm{B_{bag}}\). Moreover, the quarks are free inside the bag and are forbidden to reach out. In its simplest form, the EoS of such matter is obtained from the relation

$$\begin{aligned} P = \dfrac{1}{3}\left( \rho -4B\right) , \end{aligned}$$
(23)

where P and \(\rho \) represent the pressure and the energy density of the fluid, respectively, and the parameter B is the bag constant. Note that the external pressure acting on a bag filled with quarks vanishes for \(\rho = 4B\). It has been found that the accepted values of Bag constant B lies within the range of \(57 \le B \le 92\) MeV/fm\(^3\) [87, 88]. In the present work, we will use \(B = 57\ \mathrm MeV/fm^3\). In GR, this value is commonly used because it produces maximum-mass configurations of about \(2M_\odot \). Since the aim is to study the degree of modification with respect to Einstein’s theory, in this work we will assume the same value for B.

4.2 The charge density relation

Since our purpose is to investigate the effects of the electric charge on stellar structure, we need to specify the charge density as well. Followed by the discussion in Refs. [68, 76, 86], we assume that the charge density is proportional to the energy density, i.e.

$$\begin{aligned} \rho _{ch} = \beta \rho , \end{aligned}$$
(24)

where \(\beta \) is a charge parameter and it measures the amount of charge within the fluid sphere. This assumption is reasonable, as more material is expected to bring along a higher amount of electric charge. As in Ref. [76], in our work we will use moderate values for \(\beta \) which generate appreciable changes in the mass–radius diagrams. Furthermore, Arbañil and collaborators [86, 89] have shown that the largest value for \(\beta \) is 0.99 in order to avoid numerical convergence troubles. Finally, it is worth mentioning that there are other models in the literature to describe electrically charged quark stars, see for instance Refs. [77, 90] where it is assumed that the charge is proportional to spatial volume.

Fig. 1
figure 1

Numerical solution of the system of differential equations (12), (18) and (19) with boundary conditions (21). Radial behavior of the mass density (left panel) and pressure (right panel) for a central density \(\rho _c = 1.5 \times 10^{18}~\hbox {kg}/\hbox {m}^3\) with EoS (23) within the framework of 4D EGB gravity for \(\alpha = 4~\hbox {km}^2\). The color scale on the right side of each plot indicates different values for the charge parameter \(\beta \)

Fig. 2
figure 2

Mass parameter (left panel) and electric charge (right panel) as functions of the radial coordinate. The results are for the same solution as in Fig. 1. It can be observed that the electric charge increases both the radius and the mass (on the surface) as \(\beta \) becomes more positive

5 Numerical results and discussion

Given a specific value of the coupling constant \(\alpha \) and charge parameter \(\beta \), the system of modified TOV equations (12), (18) and (19) with boundary conditions (21) is numerically integrated from the origin at \(r= 0\) up to the stellar surface where the pressure vanishes at \(r= R\). In particular, for a central density \(\rho _c = 1.5 \times 10^{18}\ \mathrm {kg}/\mathrm {m}^3\) with EoS (23), Fig. 1 displays the mass density and pressure as functions of the radial coordinate for \(\alpha = 4\mathrm km^2\) and different values of \(\beta \). Furthermore, according to Fig. 2, the interior structure of a quark star in 4D EGB gravity is modified due to the charge parameter \(\beta \) and, therefore, both radius and total mass increase as \(\beta \) becomes more positive. Note that the mass function and electric charge are increasing quantities as we approach the surface, as expected.

The total gravitational mass and total electric charge of a particular star are determined at the surface, that is, \(M = m(R)\) and \(Q = q(R)\), respectively. For the central density considered in the previous paragraph, Table 1 shows some numerical values for the global properties of quark stars for a fixed value of \(\alpha \), and increasing \(\beta \). Meanwhile, in Table 2 we have fixed the value of \(\beta \) and varied the GB coupling constant. These results indicate that the basic properties of a compact star such as radius and mass undergo considerable changes due to the inclusion of electric charge as well as the Gauss–Bonnet term.

Table 1 Charged quark stars with central mass density \(\rho _c = 1.5 \times 10^{18}~{\hbox {kg}}/{\hbox {m}}^3\) and EoS (23) in 4D EGB gravity for \(\alpha = 4~\hbox {km}^2\) and several values of the charge parameter \(\beta \). The radial behavior of the mass density, pressure, mass parameter and electric charge of these stars is shown in Figs. 1 and 2
Table 2 Properties of charged quark stars with central mass density \(\rho _c = 1.5 \times 10^{18}~{\hbox {kg}}/{\hbox {m}}^3\) and EoS (23) in 4D EGB gravity for \(\beta = 0.2\) and different values of the GB coupling constant

The mass–radius diagrams and mass–central density relations for charged quark stars in 4D EGB gravity are presented in Fig. 3, where two values of \(\alpha \) have been considered. The results corresponding to Einstein gravity have been included by a black solid line for comparison reasons. Such plots reveal that both mass and radius vary slightly from GR in the low-mass region. Nonetheless, the mass–radius curves exhibit significant changes with respect to the general relativistic counterpart for higher central densities (i.e., close to the maximum-mass point). In other words, the maximum mass of quark stars can be increased by means of the GB constant (with positive values) as well as by the effect of electric charge. This could help explain the existence of supermassive compact stars observed in nature and that Einstein’s theory fails to predict even using exotic equations of state.

Fig. 3
figure 3

Mass-radius diagram (left panel) and mass–central density relation (right panel) for charged quark stars in 4D EGB gravity. The blue and red lines correspond to \(\alpha = 2~\hbox {km}^2\) and \(\alpha = 4~\hbox {km}^2\), respectively. Moreover, different styles of the curves stand for different values of the charge parameter \(\beta \), and the non-charged GR case is shown in both plots as a benchmark by the black solid line. We note that the gravitational mass of quark stars undergoes slight changes at low central densities and the most significant deviations occur at higher densities due to the charge and GB coupling constant. The stable quark stars on the mass–central density curves in the right panel are found in the region where \(dM/d\rho _c >0\)

Fig. 4
figure 4

The total charge as a function of the radius (left panel) and of the mass (right panel). The results for the several values of the parameter \(\beta \) as in Fig. 3 are shown. It is observed that the electric charge undergoes relevant changes due to the GB term only in the high-mass region

A traditional technique widely used in the literature to indicate the onset of instability is the \(M(\rho _c)\) method, namely, a turning point from stability to instability occurs when \(dM/d\rho _c =0\). Therefore, according to this criterion, the stable quark stars on the mass versus central density curves in the right panel of Fig. 3 are found in the region where \(dM/d\rho _c >0\). Here we must point out that this condition is necessary but not sufficient for stability analysis. A more suitable approach would be to calculate the frequency of the oscillation modes when the star is subjected to radial perturbations. We will leave this study for future work.

Furthermore, we can investigate how the total charge behaves in terms of radius and mass. According to Fig. 4, the charge increases with increasing \(\beta \), as expected. However, the changes in electrical charge associated with the Gauss–Bonnet term are more relevant for high values of mass and radius. Finally, we briefly analyze how the maximum mass changes as we vary the charge parameter \(\beta \) in the mass–radius curves shown in Fig. 3. As illustrated in Fig. 5 for three values of the coupling constant \(\alpha \), the maximum mass has a quadratic behavior with \(\beta \). Notice that in this plot the main effect of both parameters \(\alpha \) and \(\beta \) on the maximum mass of charged quark stars can be better observed.

Fig. 5
figure 5

Maximum mass as a function of the charge parameter \(\beta \) for three values of the GB coupling constant, where a quadratic behavior can be observed

6 Conclusions

Among the higher curvature gravitational theories, the recently formulated 4D EGB gravity has been widely studied because the GB term can yield a non-trivial contribution to the gravitational dynamics even in 4D spacetime. In such a context, there are several solutions ranging from cosmological to astrophysical applications. Nevertheless, there are still many aspects of this theory that require further study. Motivated by the importance of compact stars, here we have investigated the impact of electric charge on quark stars with MIT bag model EoS within the framework of 4D EGB gravity. In other words, we obtained solutions for spherically symmetric distributions of charged perfect fluid, where the distribution of electric charge inside the sphere is proportional to the energy density.

We have numerically solved the modified TOV equations for charged spheres that describe the dense matter inside QSs and obtained the physical quantities for some values of \(\alpha \) and \(\beta \). Here, we restricted our study for positive values of \(\alpha \), since only in this case more massive stellar configurations could be possible than the general relativistic counterpart, see Ref. [41]. For a given central density, we have found that the basic properties of a compact star such as mass and radius undergo relevant changes due to the inclusion of electric charge as well as the GB term.

Furthermore, our results reveal that the \(M -\rho _c\) curves are almost indistinguishable from GR in the low-mass region, whereas for higher central densities such curves exhibit significant changes with respect to the GR counterpart. We have determined the maximum-mass values of QSs and, as a consequence, we obtained masses larger than 2\(M_{\odot }\). From this perspective, one could expect the existence of supermassive compact stars in EGB gravity compared to corresponding stars in Einstein gravity. Finally, we have investigated the stellar stability following the \(M(\rho _c)\) method [91], where \(dM/d\rho _c =0\) represents a turning point from stability to instability. A stability analysis through adiabatic radial oscillations will be left for a future work.